You are here:

Using MS Access/Access 2007 Database problems



Currently I am trying to set up a database where I can use a switchboard to view the recipes I have from books etc. I have gotten my switchboard set up and I am quite happy so far but I have one main problem.

How can I get my selection to search? For example: I have a form which has all the books connected with a combo box but how can I get my selection to search for all the recipes from that book when I click on it? I am not sure how I can go about doing that.

Would you have any ideas for me please.

This is called a filter. I can't be specific without knowing how your database is setup. However it has little to do with your switchboard.

The way I would do it follows:

1) You need at least 2 tables here; tblBooks, which lists all the books you pull recipes from with an Autonumber field as your Primary Key called BookID. tblRecipes, which lists the name and description of the recipe and which would have a Foreign Key named BookID which would hold the BookID value from the tblBooks for the applicable book.

2) You need a form which lists the data from your recipe table. The bookID would bound to the BookID field but would lookup against tblBooks to select the book.

3) On this form, you have an unbound combo that also looks up against tblBooks and stores the BookID as a result.

4) finally, you have code in the After Update event of the unbound combo:
IF Not IsNull(Me.cboBookFilter) Then
    Me.Filter = "[BookID] = " & Me.cboBookFilter
    DoCmd.RunCommand acCmdApplyFilterSort
End If

So when you select a book, you will only see records relating to that book.  

Using MS Access

All Answers

Answers by Expert:

Ask Experts




I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.


I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Brooklyn College BA

©2016 All rights reserved.