A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Query Combobox Problems



 
 
Thread Tools Display Modes
  #1  
Old February 23rd, 2007, 03:55 AM posted to microsoft.public.access.queries
UnderSeven
external usenet poster
 
Posts: 11
Default 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  
Old February 23rd, 2007, 09:59 AM posted to microsoft.public.access.queries
Gary Walter
external usenet poster
 
Posts: 613
Default 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  
Old February 23rd, 2007, 01:09 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:34 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.