var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: How to reference a listbox column in query criteria?
I was wondering if anyone knew how to reference a specific column in a form listbox in the criteria of a query, similar to how you reference a control in the query criteria, like so:
I typically just reference textboxes in my queries, and I know you can reference the bound column of a listbox by just using the name of the listbox like so,
but can you reference a specific column (other than the bound column)? I tried to enter the reference the same way you would in the ControlSource of a textbox,
but that doesn't work. Enclosing the "column" portion in brackets doesn't either. And since it doesn't recognize column names in a listbox, trying to reference the column name fails, too.
Any ideas? Or should I just give up on my dreams and accept the fact that this is an impossibility?
Thanks - Jeff
I don't know if this can be done in a query? I usually do this in the code module of the form.
This would refer to column 3 of list 8. Note count is 0 to Num of columns.
You can apply the value to a variable:
strListVal = Me.List8.Column(2)
Create a Query String
qryStr = "SELECT tableTest.ID, tableTest.Field1, tableTest.Field2, tableTest.maturity " & _
" FROM tableTest " & _
" WHERE (((tableTest.maturity)='" & strListVal & "'"
Then use the query string to apply to the datasource of a form or use in a DAO or ADO recordset, or create a query.
try setting the value of a textbox on the form to the appropriate column on the listbox, then using the textbox in the query.
rogue - I had the answer the whole time and didn't even realize it. Thanks for the reply, that works perfectly.