Using a listbox's secondary column as criteria

  • Thread starter Thread starter Dennis Snelgrove
  • Start date Start date
D

Dennis Snelgrove

I've got a form which has a listbox with 4 columns of information. I need to
base the criteria for a query on the second column of this listbox. I've
used the Builder to get the reference to the listbox, but once I add the
"Column(1)", it suddenly doesn't seem to understand the reference. I'm using
this as a reference in the criteria of the query:

Forms![frmPrintTimesheetNumber]![lstTimesheetNumbers]

This criteria the query understands, but I need the second column, not the
first. Any suggestions? I've tried these, to no avail:

Forms![frmPrintTimesheetNumber]![lstTimesheetNumbers]![Column(1)]
Forms![frmPrintTimesheetNumber]![lstTimesheetNumbers].Column(1)

Thanks...
 
I believe you can use:
=Eval("Forms![frmPrintTimesheetNumber]![lstTimesheetNumbers]!Column(1)")
or place a text box on your form that has a control source of"
=[lstTimesheetNumbers]!Column(1)
Then use the new text box in the criteria.
 
Setting the hidden textbox to the value and then referencing the textbox
worked perfectly. Thanks, Duane!

Duane Hookom said:
I believe you can use:
=Eval("Forms![frmPrintTimesheetNumber]![lstTimesheetNumbers]!Column(1)")
or place a text box on your form that has a control source of"
=[lstTimesheetNumbers]!Column(1)
Then use the new text box in the criteria.


--
Duane Hookom
MS Access MVP
--

Dennis Snelgrove said:
I've got a form which has a listbox with 4 columns of information. I need
to
base the criteria for a query on the second column of this listbox. I've
used the Builder to get the reference to the listbox, but once I add the
"Column(1)", it suddenly doesn't seem to understand the reference. I'm
using
this as a reference in the criteria of the query:

Forms![frmPrintTimesheetNumber]![lstTimesheetNumbers]

This criteria the query understands, but I need the second column, not the
first. Any suggestions? I've tried these, to no avail:

Forms![frmPrintTimesheetNumber]![lstTimesheetNumbers]![Column(1)]
Forms![frmPrintTimesheetNumber]![lstTimesheetNumbers].Column(1)

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

Similar Threads


Back
Top