Error msg on 1st record only

Steven811

Registered User.
Local time
Today, 15:00
Joined
Apr 18, 2004
Messages
133
Hi

I have a cmd button on a form to open a new form and find a filtered record. This was alll working fine and yet now when I'm at the 1st record and use the cmd I receive the following error msg:

'Syntax error (missing operator) in query expression [fieldname]='

If I move to the second record it works fine.

I'd be grateful for any assistance.

Regards Steven811

The code for the cmd is as follows:

'Private Sub cmdFindSalesRecord_Click()
On Error GoTo Err_cmdFindSalesRecord_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmTopEmb_Jane"

stLinkCriteria = "[Company]=" & "'" & Me![Company] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdFindSalesRecord_Click:
Exit Sub

Err_cmdFindSalesRecord_Click:
MsgBox Err.Description
Resume Exit_cmdFindSalesRecord_Click
End Sub'
 

Users who are viewing this thread

Back
Top Bottom