Reputation: 305
Microsoft Access 2010 database gives me the following error
"Compile error: Syntax error"
In VBA window for this form it highlights the following line of code at line 3 "strSQL = "SELECT PID from tblMSCSPersonnel WHERE SSN = '" & Me!TextSSN & "';" "
The entire code is below
Private Sub Form_Current() Dim strSQL As String
strSQL = "SELECT PID from tblMSCSPersonnel WHERE SSN = '" & Me!TextSSN & "';"
Set rs = CurrentDb.OpenRecordset(strSQL)
If rs.RecordCount = 0 Then ' not in the personnel database
CmdAddToPersonnel.Enabled = True
Else
CmdAddToPersonnel.Enabled = False
End If
If Me![CmdSubmit].Visible = True Then
Me![CmdSubmit].Visible = False
Me![cmdCancel].Visible = False
End If
End Sub
Thanks
Upvotes: 0
Views: 855
Reputation: 591
Maybe remove the semicolon and use Me.
strSQL = "SELECT PID from tblMSCSPersonnel WHERE SSN = '" & Me.TextSSN & "'"
Upvotes: 0