Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use Dependant Lookup Fields in Access

Status
Not open for further replies.

mountnco

IS-IT--Management
Jan 31, 2006
10
AU
Hi all,
I've been trying to make an access database for locating our documentation on the network. The main table conatins entries for each document and also has 2 fields for categories. But I want the first categories field to determine what categories are available in the second categories field. Bascially I want a Primary Category and a Sub Category of the Primary Category! Is it possible for for this to happen? Please feel free to have a look at the database located at ftp://mountnco.kicks-ass.net/Documetation.mdb
Any Help and suggestions is greatly appreciated! Thanks in advanced!
 
First, please post Access questions in one of the seven Access forums. You'll get answers to Access there.
This question has been answered quite a few times in the Access forums. Use the search function to find answers to most of your questions.
Without looking at your database, you'd do this:

On the first combobox's Rowsource place:
SELECT Distinct [Category] FROM [TableName] WHERE [Category] is not null;

On the second combobox's Rowsource place:
SELECT DISTINCT [SubCategory] FROM [TableName WHERE [SubCategory] Is Not Null And Category=Screen.Activeform![Category];

Substitute your names for Category and SubCategory and Tablename. Be sure to name your comboboxes. The first combobox name is used in the second rowsource code.

On the AfterUpdate event of the first combobox, put:
Private Sub category_AfterUpdate()
Me![Category].Requery
Me![SubCategory].Requery
Me![SubCategory].SetFocus
Me![SubCategroy].Dropdown
End Sub

Any other questions on this will be answered in the Access forums.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top