[AccessD] Query Problem

Tim Thiessen tim at irwin-greenhouses.com
Fri Jun 6 14:54:16 CDT 2003


No, there really isn't any reason I can't go with a saved query.  I am
pretty much a novice in Access and since I have run into this problem
before, I was just wondering why this doesn't work.  Thanks.

Tim

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Wortz, Charles
Sent: Friday, June 06, 2003 2:49 PM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Query Problem


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
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3080 bytes
Desc: not available
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030606/ca4921d6/attachment-0001.bin>


More information about the AccessD mailing list