feathers212
01-03-2007, 12:50 PM
I am very new to modules within MS Access, so please be patient! I am using Access 97.
I have a form that I want to use to create records of material receipts. There are three input boxes:
ReceiptDate ? a textbox with current date as default
ReceiptMaterial ? a combobox that retrieves its dropdown values from a master materials sheet
Quantity ? a textboxNone of the inputs are bounded to any tables, etc. The user input all values and then proceeds to click the ?Submit Report? button. When the button is clicked, the transaction is supposed to be fed into the ?Material Transactions? table as a new record.
The button has the following Event Procedure:
Private Sub Submit_Receipt_Click(ReceiptMaterial As String, ReceiptDate As Date, ReceiptQuantity As Integer)
On Error GoTo Err_Submit_Receipt_Click
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("Material Transactions")
With rs
.AddNew
.Fields("Material Name") = ReceiptMaterial
.Fields("Date") = ReceiptDate
.Fields("Transaction") = "Receipt"
.Fields("Quantity") = ReceiptQuantity
.Update
.Close
End With
Exit_Submit_Receipt_Click:
Exit Sub
Err_Submit_Receipt_Click:
MsgBox Err.Description
Resume Exit_Submit_Receipt_Click
End Sub
When I hit the button, I get the following error message:
The expression On Click you entered as the even property setting produced the following error: Event procedure declaration does not match description of even having the same name.
*The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.
I?m not sure what I am doing wrong. Does it have something to do with how the variables are fed into the coding? Like I said, I am new to all of this and am unsure of what I need to do. I need to do something similar with several other tables, but am unsure about how to go around doing it!
Thanks for any input and help!!
~Heather
I have a form that I want to use to create records of material receipts. There are three input boxes:
ReceiptDate ? a textbox with current date as default
ReceiptMaterial ? a combobox that retrieves its dropdown values from a master materials sheet
Quantity ? a textboxNone of the inputs are bounded to any tables, etc. The user input all values and then proceeds to click the ?Submit Report? button. When the button is clicked, the transaction is supposed to be fed into the ?Material Transactions? table as a new record.
The button has the following Event Procedure:
Private Sub Submit_Receipt_Click(ReceiptMaterial As String, ReceiptDate As Date, ReceiptQuantity As Integer)
On Error GoTo Err_Submit_Receipt_Click
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("Material Transactions")
With rs
.AddNew
.Fields("Material Name") = ReceiptMaterial
.Fields("Date") = ReceiptDate
.Fields("Transaction") = "Receipt"
.Fields("Quantity") = ReceiptQuantity
.Update
.Close
End With
Exit_Submit_Receipt_Click:
Exit Sub
Err_Submit_Receipt_Click:
MsgBox Err.Description
Resume Exit_Submit_Receipt_Click
End Sub
When I hit the button, I get the following error message:
The expression On Click you entered as the even property setting produced the following error: Event procedure declaration does not match description of even having the same name.
*The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.
I?m not sure what I am doing wrong. Does it have something to do with how the variables are fed into the coding? Like I said, I am new to all of this and am unsure of what I need to do. I need to do something similar with several other tables, but am unsure about how to go around doing it!
Thanks for any input and help!!
~Heather