Passing the selection from a listbox to a querie

C

Chris Gorham

Hi,

I'm simply trying to use a listbox to select a date and then punch a button
to run a querie based on the selected date.

The format of the link in the querie to the listbox is
[forms]![Main Menu]![list_box_mnth_sel]![Mnth of Dump]

where "Main Menu" is the name of the form containing the listbox and button
and "list_box_mnth_sel" is the name of the listbox object and "Mnth of Dump"
is the field title of the querie behind the listbox

The listbox populates the date correctly when I open the form and when I
manually put the date into the querie that I want to link, then it runs
happily as well...

What am I doing wrong...?? Thanks...Chris
 
M

Mika Oukka

Try to use reference [forms]![Main Menu]![list_box_mnth_sel]. As the query
is run it just looks up for current the value of the listbox and uses it as
criteria. Where the listbox gets the values from is irrelevant.

Regards,

Mika
 
J

Jeff Boyce

Chris

There's a chance that what the listbox displays and what value(s) it
actually holds are not the same. That would depend on your bound column and
column widths for the listbox.

So you may be telling your query to look for "17" when what you see in the
listbox is "11/12/2007".

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
M

mcescher

Hi,

I'm simply trying to use a listbox to select a date and then punch a button
to run a querie based on the selected date.

The format of the link in the querie to the listbox is
[forms]![Main Menu]![list_box_mnth_sel]![Mnth of Dump]

where "Main Menu" is the name of the form containing the listbox and button
and "list_box_mnth_sel" is the name of the listbox object and "Mnth of Dump"
is the field title of the querie behind the listbox

The listbox populates the date correctly when I open the form and when I
manually put the date into the querie that I want to link, then it runs
happily as well...

What am I doing wrong...?? Thanks...Chris

Take a look at the column.

Forms![Main Menu]![list_box_mnth_sel].column(2)

I believe the column count starts at 0, so this example would actually
point to the third column.

Hope this helps,
Chris M.
 

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

Top