Clone Code Complication

S

Sue Compelling

Hi (Access 2007)

I have the following code which works perfectly well for me on one form,
though when I've tried to replicate it on another form I get a run time error
3077 - Syntax error (missing operator) in expression .... I hope you can help
(they look exactly the same to me!) TIA.

WORKING CODE

Private Sub SearchCombo_AfterUpdate()
With Me.RecordsetClone
.FindFirst "JobID = " & SearchCombo
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
Me.Notes.SetFocus
End Sub


NON - WORKING CODE

Private Sub SearchCbo_AfterUpdate()
With Me.RecordsetClone
.FindFirst "NIRID = " & SearchCbo
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
Me.Customer.SetFocus
End Sub
 
S

Stuart McCall

Sue Compelling said:
Hi (Access 2007)

I have the following code which works perfectly well for me on one form,
though when I've tried to replicate it on another form I get a run time
error
3077 - Syntax error (missing operator) in expression .... I hope you can
help
(they look exactly the same to me!) TIA.

WORKING CODE

Private Sub SearchCombo_AfterUpdate()
With Me.RecordsetClone
.FindFirst "JobID = " & SearchCombo
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
Me.Notes.SetFocus
End Sub


NON - WORKING CODE

Private Sub SearchCbo_AfterUpdate()
With Me.RecordsetClone
.FindFirst "NIRID = " & SearchCbo
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
Me.Customer.SetFocus
End Sub

Well one thing jumps out straightaway. In the working version your combo is
called SearchCombo, whereas in the non-working code, it's called SearchCbo.
Perhaps you need to review your control names...
 
S

Sue Compelling

Hi Linq

It's definitely a number (NIRID is an AutoNumber).

The two forms are actually in the same database and store different record
types - hence the SearchCombo for one Form and the SerchCbo for the other
form.

Is that possibly what's making the difference?

ps - when I run my cursor over the .FindFirst "NIRID = " & SearchCbo in the
code it shows up the right data (ie - what's been selected in my SearchCbo)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Code no longer works 4
Openargs Not Working 2
form sequence code not working 2
With error 7
Code Issues 1
Cbo Not In List code error 9
searh for record. 2
Using a quick key to navigate wont work 2

Top