Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / July 2005

Tip: Looking for answers? Try searching our database.

Running a query from a combo box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joel - 01 Jul 2005 16:39 GMT
On my form I have a combo box pulls data from a table (table1) and saves it
to another table. I have a 2nd combo box that does the same thing but from a
differnt table (table2). I want to filter the 2nd combo box depending on my
1st combo box's selection.

ex: I select "Site A" (from table1) for combo box 1, I want combo box 2 to
filter everything that says "Site A" (from table2)  and display it for me to
select to input it into table3.

I have been trying for hours to ge tthis to work so any help would be
greatly appreciated! Thanks
KARL DEWEY - 01 Jul 2005 16:44 GMT
Build a query for the 2nd combo box source.  Use the first combo box as
criteria for the query.
You will need to refresh the query on opening the 2nd combo box.

> On my form I have a combo box pulls data from a table (table1) and saves it
> to another table. I have a 2nd combo box that does the same thing but from a
[quoted text clipped - 7 lines]
> I have been trying for hours to ge tthis to work so any help would be
> greatly appreciated! Thanks
Joel - 01 Jul 2005 16:55 GMT
Would you mind explaining how to do that for me? (sorry im still new to access)
Thanks

> Build a query for the 2nd combo box source.  Use the first combo box as
> criteria for the query.
[quoted text clipped - 11 lines]
> > I have been trying for hours to ge tthis to work so any help would be
> > greatly appreciated! Thanks
KARL DEWEY - 01 Jul 2005 17:49 GMT
Build a query with criteria --
[Forms]![YourForm]![YourComboBox1]

Create a macro named RequeryComboBox2 with action Requery.

Open your form in DESIGN view. Right click the 2nd combobox. Select
Properties.
For Row Source select your query.
For On Enter select Macro.RequeryComboBox2.

Save.

> Would you mind explaining how to do that for me? (sorry im still new to access)
> Thanks
[quoted text clipped - 14 lines]
> > > I have been trying for hours to ge tthis to work so any help would be
> > > greatly appreciated! Thanks
Joel - 02 Jul 2005 17:58 GMT
When I make the macro with the Requery action, what do I put as the control
name? No matter what I put in there, whenever I got back to my form and click
on combobox 2 it says "There is no field named "(whatever is in the control
name)" in the current record" and if i leave it blank then I cant even click
on combobox 2.

And suggestions?

Thanks

> Build a query with criteria --
> [Forms]![YourForm]![YourComboBox1]
[quoted text clipped - 26 lines]
> > > > I have been trying for hours to ge tthis to work so any help would be
> > > > greatly appreciated! Thanks
Joel - 01 Jul 2005 17:56 GMT
Ok well I got from Karl's reply.

Here is what I did.
1st I made a Query For everything I needed

Then

In the 1st combo box I used the after update function and wrote this code:

Private Sub Combo1_AfterUpdate()
If combo1 = "Site A" then
combo2.RowSource = "QuerySiteA"
Else
End If
End Sub

If anyone knows a better/easier way to do this, Please let me know =)

Thank You Karl

> Would you mind explaining how to do that for me? (sorry im still new to access)
> Thanks
[quoted text clipped - 14 lines]
> > > I have been trying for hours to ge tthis to work so any help would be
> > > greatly appreciated! Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.