I've used code compiled from other threads I've read to create a sub that adds a single record onto a table, using the values in the current form to populate the two fields. However, I get an 'Type Mismatch' error message returned and it highlights the Set Recordset line as the problem. Can anyone help and explain why?
CODE:
Private Sub Command60_Click()
Dim db As Database
Dim rsUsers As Recordset
Dim intResponse As Integer
Set db = CurrentDb()
Set rsUsers = db.OpenRecordset("TblSubscriptionUser", dbOpenTable, dbAppendOnly)
rsUsers.AddNew
rsUsers("SubscriptionID") = Me.txtContactID
rsUsers("ContactID") = Me.SelectedSubscriptionID
rsUsers.Update
rsUsers.Close
intResponse = MsgBox("New User Added", vbOKOnly, "Enter New Subscription User")
End Sub
I'm running Windows 2k on XP
CODE:
Private Sub Command60_Click()
Dim db As Database
Dim rsUsers As Recordset
Dim intResponse As Integer
Set db = CurrentDb()
Set rsUsers = db.OpenRecordset("TblSubscriptionUser", dbOpenTable, dbAppendOnly)
rsUsers.AddNew
rsUsers("SubscriptionID") = Me.txtContactID
rsUsers("ContactID") = Me.SelectedSubscriptionID
rsUsers.Update
rsUsers.Close
intResponse = MsgBox("New User Added", vbOKOnly, "Enter New Subscription User")
End Sub
I'm running Windows 2k on XP