If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Query Combobox Problems
This is the code of my query:
SELECT Table.Column FROM Table INNER JOIN Othertable ON Table.Column = Othertable.Column WHERE (((Table.Column)=[Forms]![Formname]![cboname].[RowSource])) ORDER BY Othertable.Column; It's called by a list box in the same Form as the rowsource, it's meant to populate said list. Now the problem I am having is, no matter what I do, the moment I open the form it asks for the parameter instead of just taking it out of the combobox, also I can't seem to get the listbox to run the query again if I update the combobox. I've taken a look at some of the online help but the solutions they give do not seem to work for me (partially because I havn' found one yet using this method to populate a listbox) Please help! I am using Access 2003 |
#2
|
|||
|
|||
Query Combobox Problems
"UnderSeven" wrote: This is the code of my query: SELECT Table.Column FROM Table INNER JOIN Othertable ON Table.Column = Othertable.Column WHERE (((Table.Column)=[Forms]![Formname]![cboname].[RowSource])) ORDER BY Othertable.Column; It's called by a list box in the same Form as the rowsource, it's meant to populate said list. Now the problem I am having is, no matter what I do, the moment I open the form it asks for the parameter instead of just taking it out of the combobox, also I can't seem to get the listbox to run the query again if I update the combobox. I've taken a look at some of the online help but the solutions they give do not seem to work for me (partially because I havn' found one yet using this method to populate a listbox) You might be trying to do something out of my experience, but I think you just want to get rid of ".[RowSource]" in your query. [Forms]![Formname]![cboname] will provide the value of the bound column of your combo box... SELECT Table.Column FROM Table INNER JOIN Othertable ON Table.Column = Othertable.Column WHERE (((Table.Column)=[Forms]![Formname]![cboname])) ORDER BY Othertable.Column; |
#3
|
|||
|
|||
Query Combobox Problems
1)
Try changing the SQL of the Row source to something like the following SELECT Table.Column FROM Table INNER JOIN Othertable ON Table.Column = Othertable.Column WHERE Table.Column=[Forms]![Formname]![cboname] ORDER BY Othertable.Column; 2) In the combobox after update event, you need vba code that will requery the listbox Me.lstBoxName.Requery 'Replace "lstBoxName" with the name of your listbox (Click on combobox; select properties, enter [Event Procedure] in the After Update event; click on the three dots; enter the above code in the procedure) -- John Spencer Access MVP 2002-2005, 2007 Center for Health Program Development and Management University of Maryland Baltimore County .. "UnderSeven" wrote in message ... This is the code of my query: SELECT Table.Column FROM Table INNER JOIN Othertable ON Table.Column = Othertable.Column WHERE (((Table.Column)=[Forms]![Formname]![cboname].[RowSource])) ORDER BY Othertable.Column; It's called by a list box in the same Form as the rowsource, it's meant to populate said list. Now the problem I am having is, no matter what I do, the moment I open the form it asks for the parameter instead of just taking it out of the combobox, also I can't seem to get the listbox to run the query again if I update the combobox. I've taken a look at some of the online help but the solutions they give do not seem to work for me (partially because I havn' found one yet using this method to populate a listbox) Please help! I am using Access 2003 |
Thread Tools | |
Display Modes | |
|
|