How come this SQL statement doesn't work?

  • Thread starter Thread starter Gainger Gran
  • Start date Start date
G

Gainger Gran

I have this code set in my Row Source of a ListBox.
How come it does not work?

SELECT Data1.BID FROM Data1 WHERE (((Data1.BID)=CurrentRecord));

I am trying to run a query and have it use the current record.

Help!
 
I'm not sure what you're asking for exactly so I'm going to ask a couple more
questions...

What datatype is the field "BID?" What are you trying to retrieve from
Data1? Last, what type of values are in BID?
 
Instead of using "Current Record" trying using the name of the field that is
your primary key like "intID"

It would look like this then.

SELECT Data1.BID FROM Data1 WHERE (((Data1.BID)=[intID]));

With your SQL statement it probably is using the string of text
"currentrecord" as the criteria. When you put an actual field name in there
with the [] then it may work.

Another way to do it would to do it in code in VB. Maybe on the forms "on
current" event you can set the row source of the list box. If you are
interested in this solution let me know.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top