I can't seem to understand why this doesn't work. i copied and pasted it from a previous project and worked like a dream. and yes, tblScout does exist!
(erroneous line in bold)
Option Compare Database
Dim Rsttable As Recordset
Private Sub cmdadd_Click()
If IsNull(firstname) = True Then
MsgBox "Please enter a First Name"
firstname.SetFocus
Else
If IsNull(surname) = True Then
MsgBox "Please enter a Last Name"
surname.SetFocus
Else
Set Rsttable = CurrentDb.OpenRecordset("tblScout", dbOpenDynaset)
Rsttable.AddNew
Rsttable!firstname = firstname
Rsttable!surname = surname
Rsttable!DOB = DOB
Rsttable!address1 = address1
Rsttable!Address2 = Address2
Rsttable!Address3 = Address3
Rsttable!postcode = postcode
Rsttable!phone1 = phone1
Rsttable!phone2 = phone2
Rsttable!email = email
Rsttable.Update
Rsttable.Close
MsgBox "" & firstname & " " & LastName & " was successfully added."
DoCmd.Close
End If
End If
End Sub
any idea?
(erroneous line in bold)
Option Compare Database
Dim Rsttable As Recordset
Private Sub cmdadd_Click()
If IsNull(firstname) = True Then
MsgBox "Please enter a First Name"
firstname.SetFocus
Else
If IsNull(surname) = True Then
MsgBox "Please enter a Last Name"
surname.SetFocus
Else
Set Rsttable = CurrentDb.OpenRecordset("tblScout", dbOpenDynaset)
Rsttable.AddNew
Rsttable!firstname = firstname
Rsttable!surname = surname
Rsttable!DOB = DOB
Rsttable!address1 = address1
Rsttable!Address2 = Address2
Rsttable!Address3 = Address3
Rsttable!postcode = postcode
Rsttable!phone1 = phone1
Rsttable!phone2 = phone2
Rsttable!email = email
Rsttable.Update
Rsttable.Close
MsgBox "" & firstname & " " & LastName & " was successfully added."
DoCmd.Close
End If
End If
End Sub
any idea?