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

DAO RecordSet question

P: n/a
I have an increasingly-complicated query string that sends results to
an Excel file; I've broken the query somehow.

Currently using Access 2007, DAO recordset via late binding (we don't
have control of all client's machines to change references).

First question - the query string is redundant to a SQL query within
the database, so I wondered about passing the query directly
(something like Set rs = db.OpenRecordset("qryByAnalyte") ).
Simplest.

However, "qryByAnalyte" takes several parameters - so I think I'm
stuck rebuilding the query a la, "sqltext = "SELECT ... everything in
gods universe... [param1] etc", then executing:
qry.Parameters("param1").Value = Me.cboBox.Value
qry.SQL = sqltxt
Set rs = qry.OpenRecordset

Second question - unfortunately this breaks - error '3075' tells me I
have an error in formatting the sqltxt string. "In operator without
() in query expression '(...

Thanks for tips.
Aug 22 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Solved the query issue, doh - changed to multiple selection "In
(param1, param2)" and forgot the parentheses.

Thanks!

On Aug 22, 1:34 pm, Jeff <jnorvi...@gmail.comwrote:
I have an increasingly-complicated query string that sends results to
an Excel file; I've broken the query somehow.

Currently using Access 2007, DAO recordset via late binding (we don't
have control of all client's machines to change references).

First question - the query string is redundant to a SQL query within
the database, so I wondered about passing the query directly
(something like Set rs = db.OpenRecordset("qryByAnalyte") ).
Simplest.

However, "qryByAnalyte" takes several parameters - so I think I'm
stuck rebuilding the query a la, "sqltext = "SELECT ... everything in
gods universe... [param1] etc", then executing:
qry.Parameters("param1").Value = Me.cboBox.Value
qry.SQL = sqltxt
Set rs = qry.OpenRecordset

Second question - unfortunately this breaks - error '3075' tells me I
have an error in formatting the sqltxt string. "In operator without
() in query expression '(...

Thanks for tips.
Aug 22 '08 #2

P: n/a
Jeff <jn*******@gmail.comwrote:
>Currently using Access 2007, DAO recordset via late binding (we don't
have control of all client's machines to change references).
Late binding for which? If Excel then great. If DAO then not necessary.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Aug 25 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.