473,408 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Opening form to specific record

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
2 1914
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Susan Bricker | last post by:
Hi. I am trying to open a form using 'openargs' parameter of the docmd.openform action. The problem is that I would like to pass the form some character (string) and integer data. My plan was to...
9
by: BLUE WATER | last post by:
Help, When I am finished entering in data into my form A, I press the save button that saves this new data to a new record. However I would like my other form to open at a specific record, the...
1
by: Ian | last post by:
I want to open a form at a particular record, but I think I'm running into problems because the recordsource query is executing asynchronously. In the form's open event I use...
7
by: Sam | last post by:
Hello All, We want our Call Service Representatives to be able to go back and view all the records in a table on a form. When closing and re-opening the form the form starts out as record 1 of 1...
3
by: MartinR | last post by:
Hi, I'm still new to writing code in vba as I've only been introduced to access three weeks ago. I have written this code below and it executes but does not do what I want it to do. What I want is...
2
by: rousseaud | last post by:
I have a continuous form, frmA, that lists certain record fields from tblB. I want to be able to click on one of the records in frmA (just an on click event on one of the form fields) and have that...
7
by: mahgnilla | last post by:
Hi, I was wondering if anyone could help?! I have a button on one form (Participant form) that opens another form at a specific record (Learning Session form with specific session for that...
1
by: Martin Bentler | last post by:
Right now, I have a form, locked records, on which I have a CommandButton that opens a second form (much like the first) but open for editing, plus allowing the user to manipulate other areas of the...
11
by: casan.mike | last post by:
Hi all, I have a form called "customer_frm" with many records in it. I would like to have a form that has a combobox listing all the customers, and a button that open the "customers_frm" to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.