Wortz, Charles
CWortz at tea.state.tx.us
Fri Jun 6 14:49:05 CDT 2003
Tim, I am coming into this late, so I may have missed something. But from the below I do not see any reason why a saved query and a QueryDef would not meet your needs. Did you specify something earlier that did not get copied where you gave a valid reason for not going this way? Charles Wortz Software Development Division Texas Education Agency 1701 N. Congress Ave Austin, TX 78701-1494 512-463-9493 CWortz at tea.state.tx.us -----Original Message----- From: Tim Thiessen [mailto:tim at irwin-greenhouses.com] Sent: Friday 2003 Jun 06 14:37 To: accessd at databaseadvisors.com Subject: RE: [AccessD] Query Problem Robert, I tried both of your suggestions but neither worked. I was able to make it work using a saved query and calling a QueryDef but that's not exactly what I wanted to do. Tim Tim, If trying to build an SQL string, you need to concatenate the pieces without the line continuation indicator (_) as in: sqlWSName = "SELECT DISTINCT qryInvItemWrkSht.worksheet, " sqlWSName = sqlWSName & "qryInvItemWrkSht.worksheet_desc " sqlWSName = sqlWSName & "FROM qryWrkSht INNER JOIN qryInvItemWrkSht " sqlWSName = sqlWSName & "ON qryWrkSht.[Item Number] = qryInvItemWrkSht.Item;" If trying to show a single statement wrapped, I believe you use the continuation marker, but drop the quotes: sqlWSName = "SELECT DISTINCT qryInvItemWrkSht.worksheet, _ qryInvItemWrkSht.worksheet_desc _ FROM qryWrkSht INNER JOIN qryInvItemWrkSht _ ON qryWrkSht.[Item Number] = qryInvItemWrkSht.Item;" I think you may want the latter construction. > -----Original Message----- > From: Tim Thiessen [mailto:tim at irwin-greenhouses.com] > Sent: Friday, June 06, 2003 12:00 PM > Subject: [AccessD] Query Problem > > Can anyone tell me what I am doing wrong here? When I run this as a > stand alone query, it runs fine but when its in the form as code, I > get the error message "Run-time error 3061 Too few parameters. > Expected 1" > > sqlWSName = "SELECT DISTINCT qryInvItemWrkSht.worksheet, " _ > & "qryInvItemWrkSht.worksheet_desc " _ > & "FROM qryWrkSht INNER JOIN qryInvItemWrkSht " _ > & "ON qryWrkSht.[Item Number] = qryInvItemWrkSht.Item;" Set > rstWSName = CurDb.OpenRecordset(sqlWSName) > > Tim Thiessen