I've written a function which uses a DAO Recordset. The following statement sets the recordset:
Set rs = db.OpenRecordset("qryLast24Months")
My dilemma is that when my query has a criteria set as follows: [forms]![frmModels].[ModelNum], the function will not work due to a syntax error. However, if I set the criteria to an actual modelnum such as 7300, the function works just fine.
Any help or ideas are appreciated.
9 2803
I've written a function which uses a DAO Recordset. The following statement sets the recordset:
Set rs = db.OpenRecordset("qryLast24Months")
My dilemma is that when my query has a criteria set as follows: [forms]![frmModels].[ModelNum], the function will not work due to a syntax error. However, if I set the criteria to an actual modelnum such as 7300, the function works just fine.
Any help or ideas are appreciated.
Try changing the . to a !
I've written a function which uses a DAO Recordset. The following statement sets the recordset:
Set rs = db.OpenRecordset("qryLast24Months")
My dilemma is that when my query has a criteria set as follows: [forms]![frmModels].[ModelNum], the function will not work due to a syntax error. However, if I set the criteria to an actual modelnum such as 7300, the function works just fine.
Any help or ideas are appreciated.
This question may seem a little silly, but is frmModels Open?
This question may seem a little silly, but is frmModels Open?
The form is open...I also tried changing the . to a ! but it still throws a run-time error "Item not found in this collection".
That usually means you've misspelled something.
What's db set to?
That usually means you've misspelled something.
What's db set to?
db is set as follows:
Set db = CurrentDb()
Does the query work outside of code? What's the SQL for the query?
Does the query work outside of code? What's the SQL for the query?
The query does work outside the code so I decided to try to put the query SQL statement in my function instead and was able to get it to work that way. Tks.
The query does work outside the code so I decided to try to put the query SQL statement in my function instead and was able to get it to work that way. Tks.
Well, glad you got it working. Good luck.
I've written a function which uses a DAO Recordset. The following statement sets the recordset:
Set rs = db.OpenRecordset("qryLast24Months")
My dilemma is that when my query has a criteria set as follows: [forms]![frmModels].[ModelNum], the function will not work due to a syntax error. However, if I set the criteria to an actual modelnum such as 7300, the function works just fine.
Any help or ideas are appreciated.
Jet's pretty strange about recordsets. Sometimes you can get away with using just the query name, others you can't. there is a workaround
Set rs = db.OpenRecordset("select * from qryLast24Months;")
Should do.
J
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Josh Strickland |
last post by:
I am attempting to create an Access database which uses forms to enter
data. The issue I am having is returning the query results from the
Stored Procedure back in to the Access Form.
...
|
by: j.mandala |
last post by:
Someone is trying to run my Access 2002 database under Access 2003. He
has had a number of problems:
1) i used the MSComCt2.ocx for it's Date and Time picker. I can't find
it under 2003. Do I...
|
by: JMCN |
last post by:
object invalid or no longer set - confusion of the recordset in access
2003.
i am currently converting from access 97 to access 2003. majority of
the codes converted over perfectly fine, though...
|
by: alex_peri |
last post by:
Hello All,
I am having problems with sorting a recordset by fields in Access. I
have a table with three columns called ID, SNo and Time and would like
to sort the records by Time. I would like to...
|
by: totierne |
last post by:
comp.databases.ms-access,
I want to know how to use Oracle views with session variables in
Access.
The parameterised views in access, are migrated to views with per
session
variables.
The...
|
by: jayohare |
last post by:
Hello,
I have code within my DB application to process credit cards through
authorize.net. Ive been using the same code for several years without a
problem.
I have an order entry computer and...
|
by: ARC |
last post by:
Just curious if anyone is having issues with Acc 2007 once the number of
objects and complexity increases? I have a fairly large app, with many
linked tables, 100's of forms, queries, reports, and...
|
by: Yarik |
last post by:
Hello,
Here is a sample (and very simple) code that binds an Access 2003 form
to a fabricated ADO recordset:
' Create recordset...
Dim rs As ADODB.Recordset: Set rs = New ADODB.Recordset
'...
|
by: jsacrey |
last post by:
Hello everybody,
I've got a bit of a situation that I could use some guidance with if
possible. I work for an auditing firm where my users audit electronic
shipping data for customers to see if...
|
by: curran.george |
last post by:
'add one textbox to form1 with Control Source property = ID
'copy/paste the form_load code below:
'Then open the form and then attempt to sort the datasheet
'crashes 2003, error 3450 Access 2007 -...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |