Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQL HELP Seems Simple

0 views
Skip to first unread message

Brandon Johnson

unread,
Jul 17, 2006, 5:35:54 PM7/17/06
to
Can anyone help me with this? Ive done this before but for some odd
reason its throwing me a runtime '2001' error. Its pretty urgent that i
get this resolved before tom. so if anyone can help, much appreciation.

promotetemp: a string that is chosen from a drop down to choose what
table to get to.
criteria: a string that has a list of upcs to search for in the table
chosen. format: ('__','__',etc)

Me.frmPromote.Form.RecordSource = "SELECT UPCCase, UPCItem, SVDCName,
SVItemCd, SVBrand, SVDescription, SVPack, SVSize, SVStatus, WeekFcst,
VendorPkCost, SVSell FROM z" & promotetemp & " WHERE UPCCase IN " &
criteria & ";"

Douglas J. Steele

unread,
Jul 17, 2006, 5:42:11 PM7/17/06
to
Are there any spaces in what's in promotetemp? If so, try:

Me.frmPromote.Form.RecordSource = "SELECT UPCCase, UPCItem, SVDCName,
SVItemCd, SVBrand, SVDescription, SVPack, SVSize, SVStatus, WeekFcst,
VendorPkCost, SVSell FROM [z" & promotetemp & "] WHERE UPCCase IN " &
criteria & ";"

Otherwise, try putting the string into a variable and printing the variable
to the Immediate window (Ctrl-G). Does the SQL look correct? Does it run
when you copy it into a query?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Brandon Johnson" <xtant...@gmail.com> wrote in message
news:1153172154.0...@h48g2000cwc.googlegroups.com...

Brandon Johnson

unread,
Jul 17, 2006, 5:50:26 PM7/17/06
to
Thats what came of it:
SELECT * FROM [zClorox] WHERE UPCCase IN ('4460001683');

everything looks correct to me.(that z is suppose to be there btw, its
how i named all my tables for ease). Does anyhting stand out to you?

Douglas J. Steele

unread,
Jul 17, 2006, 7:27:08 PM7/17/06
to
Error 2001 ("You canceled the previous operation.") is the error that's
issued if you've mistyped either the table or field name. (Yeah, I know it's
not intuitive...)

On the other hand, it looks as though you might have separate tables for
each product. That's a mistake: you should have a single table, with an
additional field to identify the product.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Brandon Johnson" <xtant...@gmail.com> wrote in message

news:1153173026.6...@b28g2000cwb.googlegroups.com...

0 new messages