473,387 Members | 1,504 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,387 software developers and data experts.

DAO.OpenRecordset throws an error but SQL is good

According to Access 2007, when I use the query builder, this sql code returns exactly what I want from my table

Expand|Select|Wrap|Line Numbers
  1. Select reports.[rptName] FROM reports WHERE (((reports.rptLable)=[Forms]![startup]![rptPicker]));
but when I am using the DAO.OpenRecordset method to run the sql statement I get an error saying "to few parameters. Expected 1"

Any help resolving this will be greatly appreciated.

Thanks
Oct 13 '08 #1
2 1873
I solved my problem.

It appears DAO.OpenRecordset does not like all the stuff that Access throws around like the form hierarchy and stuff. so I replaced the [forms]!... with a variable name and concantinated it in and it worked.
Oct 13 '08 #2
NeoPa
32,556 Expert Mod 16PB
That's about it. And thanks for letting us know it's resolved.

Object references like that are valid within VBA but not from all areas (Like the DAO Jet SQL engine). I can't fully explain why it runs ok when dropped into the SQL page of a QueryDef.
Oct 13 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: el Benno | last post by:
If CurrentDb.OpenRecordset("table").EOF Then ... works fine If CurrentDb.OpenRecordset("Query").EOF Then ... doesn't????????? microsft help is outstanding too - surprise surprise any help...
5
by: Philippa | last post by:
I'm trying to access data in vba using the openrecordset command. The data in on a SQL Server 2000 database, and I have linked tables to that data. the Table I'm trying to access is one of these...
8
by: Russell Potter | last post by:
I'm trying to create a recordset using "currentDB.OpenRecordSet", using a query as the "source" string (the only parameter: so all the others are set to their defaults which, I believe, means...
2
by: K Williams | last post by:
I recently discovered that you can do the following: if currentdb.openrecordset ("select statement.....").eof = true then for cases when you just want to see if any records exist. This...
11
by: MLH | last post by:
If this is what MySQL is set to... SELECT DISTINCTROW qryVehiclesNowners5.SerialNum, qryVehiclesNowners5.VDescr, qryVehiclesNowners5.Owner, qryVehiclesNowners5.VehicleJobID ,...
5
by: Sunnyrain | last post by:
I am developing a program in Access 2000. I couldn't make OpenRecordset method work right. It's working when I opened a simple SQL query below in OpenRecordset. ..... Dim dbs As Database, rst...
10
by: MLH | last post by:
Gentlemen: I am having one heck of a time taking a DAO walk through the records in an SQL dynaset. I'm trying to walk a set of records returned by a UNION query. I'm attempting to filter the...
22
by: MLH | last post by:
100 Dim db As Database, rst As Recordset 120 Set db = CurrentDb 140 PString = "SELECT qryBatchList.ReadyFor906, qryBatchList.BatchID FROM qryBatchList WHERE...
7
by: mirandacascade | last post by:
The questions are toward the bottom of this post. Situation is this: 1) Access 97 2) Multi-user appplication 3) SQL Server 2000 4) Sporadically (i.e. less than 1% of the time) encounter the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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...
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:
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 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.