By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,145 Members | 1,536 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,145 IT Pros & Developers. It's quick & easy.

Opening form to specific record

P: n/a
Hi, I'm opening one form from another, passing the criteria through using
OpenArgs (this works correctly - I have tested with a msgbox).

The problem is with the findfirst method, I get the syntax error 'missing
operator in expression' on line 2 of the following:

If Len(Me.OpenArgs) Then
Me.RecordsetClone.FindFirst "campaign = " & Me.OpenArgs
If Not Me.RecordsetClone.NoMatch Then Me.Bookmark =
Me.RecordsetClone.Bookmark
End If

Any pointers?
I admit the above is a bit of a cut and paste job so I might be on the wrong
track completely, but 'campaign' is a field in the forms recordsource query,
and OpenArgs is the string criteria I want to pick the correct record.

Cheers,
Chris

Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
What is the data type of the "campaign" field?
If Text (not Number), include extra quotes:
Me.RecordsetClone.FindFirst "campaign = """ & Me.OpenArgs & """"

Also, be sure to do this in Form_Load. Form_Open may be too early.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Not Me" <No****@faker.fake.fa.ke> wrote in message
news:c1**********@ucsnew1.ncl.ac.uk...
Hi, I'm opening one form from another, passing the criteria through using
OpenArgs (this works correctly - I have tested with a msgbox).

The problem is with the findfirst method, I get the syntax error 'missing
operator in expression' on line 2 of the following:

If Len(Me.OpenArgs) Then
Me.RecordsetClone.FindFirst "campaign = " & Me.OpenArgs
If Not Me.RecordsetClone.NoMatch Then Me.Bookmark =
Me.RecordsetClone.Bookmark
End If

Any pointers?
I admit the above is a bit of a cut and paste job so I might be on the wrong track completely, but 'campaign' is a field in the forms recordsource query, and OpenArgs is the string criteria I want to pick the correct record.

Cheers,
Chris

Nov 12 '05 #2

P: n/a
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:40***********************@freenews.iinet.net. au...
"Not Me" <No****@faker.fake.fa.ke> wrote in message
news:c1**********@ucsnew1.ncl.ac.uk...
The problem is with the findfirst method, I get the syntax error 'missing operator in expression' on line 2 of the following:

If Len(Me.OpenArgs) Then
Me.RecordsetClone.FindFirst "campaign = " & Me.OpenArgs
If Not Me.RecordsetClone.NoMatch Then Me.Bookmark =
Me.RecordsetClone.Bookmark
End If

Any pointers?
What is the data type of the "campaign" field?
If Text (not Number), include extra quotes:
Me.RecordsetClone.FindFirst "campaign = """ & Me.OpenArgs & """"

Also, be sure to do this in Form_Load. Form_Open may be too early.


Brilliant, it was the quotes wot fixed it :)

Cheers,
Chris
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.