Passing value to Query Criteria from ListBox

A

Atif

Hi.

In Access 2007 how can we pass values from a Listbox to a Query as criteria.

presently I am using a Command Button to call a Macro which displays Query
in Povit Chart View. I want to you a ListBox insted Command button so user
can filtered data.

Thanks
 
J

Jeff Boyce

You don't need to!

You can modify your query to look for a value selected in a listbox on an
open form. This assumes you are only using a single selection as your
criterion.

In your SelectionCriterion property, you'd use something like:

Forms!YourFormName!lstYourListboxName

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
A

Atif

Hi Jeff:

I am calling the same Macro throug List box and my Criteria is:
[Forms]![Switchboard]![List82]
I am receving Error, Database Engin does not recognized
[Forms]![Switchboard]![List82] as valid field name or expression.

Whats wrong?

Atif
 
J

Jeff Boyce

Access is very picky about spelling. Are you certain the name of the form
and the name of the control are both spelled exactly?

Have you used the "builder" feature in the query to simply "point" to the
correct control/form?

Is the form open when you run the query?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Atif said:
Hi Jeff:

I am calling the same Macro throug List box and my Criteria is:
[Forms]![Switchboard]![List82]
I am receving Error, Database Engin does not recognized
[Forms]![Switchboard]![List82] as valid field name or expression.

Whats wrong?

Atif



Jeff Boyce said:
You don't need to!

You can modify your query to look for a value selected in a listbox on an
open form. This assumes you are only using a single selection as your
criterion.

In your SelectionCriterion property, you'd use something like:

Forms!YourFormName!lstYourListboxName

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
A

Atif

Hi Jeff:

the spelling are correct and I used builder feature as well, still "Enging
not able to recognized the refered objects.

Atif

Jeff Boyce said:
Access is very picky about spelling. Are you certain the name of the form
and the name of the control are both spelled exactly?

Have you used the "builder" feature in the query to simply "point" to the
correct control/form?

Is the form open when you run the query?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Atif said:
Hi Jeff:

I am calling the same Macro throug List box and my Criteria is:
[Forms]![Switchboard]![List82]
I am receving Error, Database Engin does not recognized
[Forms]![Switchboard]![List82] as valid field name or expression.

Whats wrong?

Atif



Jeff Boyce said:
You don't need to!

You can modify your query to look for a value selected in a listbox on an
open form. This assumes you are only using a single selection as your
criterion.

In your SelectionCriterion property, you'd use something like:

Forms!YourFormName!lstYourListboxName

Regards

Jeff Boyce
Microsoft Office/Access MVP


Hi.

In Access 2007 how can we pass values from a Listbox to a Query as
criteria.

presently I am using a Command Button to call a Macro which displays
Query
in Povit Chart View. I want to you a ListBox insted Command button so
user
can filtered data.

Thanks
 
J

Jeff Boyce

Atif

Sorry, but I haven't run across that particular situation. Have you tried
searching on-line for the error message you are receiving?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Atif said:
Hi Jeff:

the spelling are correct and I used builder feature as well, still "Enging
not able to recognized the refered objects.

Atif

Jeff Boyce said:
Access is very picky about spelling. Are you certain the name of the
form
and the name of the control are both spelled exactly?

Have you used the "builder" feature in the query to simply "point" to the
correct control/form?

Is the form open when you run the query?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Atif said:
Hi Jeff:

I am calling the same Macro throug List box and my Criteria is:
[Forms]![Switchboard]![List82]
I am receving Error, Database Engin does not recognized
[Forms]![Switchboard]![List82] as valid field name or expression.

Whats wrong?

Atif



:

You don't need to!

You can modify your query to look for a value selected in a listbox on
an
open form. This assumes you are only using a single selection as your
criterion.

In your SelectionCriterion property, you'd use something like:

Forms!YourFormName!lstYourListboxName

Regards

Jeff Boyce
Microsoft Office/Access MVP


Hi.

In Access 2007 how can we pass values from a Listbox to a Query as
criteria.

presently I am using a Command Button to call a Macro which displays
Query
in Povit Chart View. I want to you a ListBox insted Command button
so
user
can filtered data.

Thanks
 

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