Code for "OK" in Dialog Box to lead to selected records in Form Vi

N

Natasha

Let's say that I have a "United States" Database with 50 records - each
record contains information about each state (i.e. population, state bird,
sports teams, governor's name, etc.)

Once the database is opened, the user will go to a switchboard, that
contains several search for lists (i.e search by state bird, search by
governor's name) Pressing any "search for" button will run a macro that will
lead them to a drop down menu for that category.

Now let's say that the user wants to see all records where the governor's
name is John Smith, and there are 5 states whose governor's name is John
Smith. What code do I enter in for "OK" in the dialog box so that when
users click "OK" after choosing "John Smith" , Access will show me only those
5 records whose governor is John Smith....BUT.....I want Access to show me
those records in a particular form IN Form View - not as a report.
 
G

golfinray

Let me ask a couple of questions. First, name is not very good to search on
at all because of just what you said: There may be several John Smith's. So
do you have anything unique to search on? Like a primary key, or if nothing
else, an autonumber field. In my opinion, you would need to have a unique key
ID for each state. Let's say Alaska's ID is 1000, Arkansas' is 2000,
Arizona's is 3000. Now you could set up 2 tables with a one to many
relationship. One would be the states. Many would be the information about
each state. Now in order to get that to work properly on a form, you set up a
foreign key. The ID is the Primary Key in the one table, and the foreign key
in the many table. Now you create a mainform and subform. The One side is the
mainform and the many side is the subform. Post back further questions, if
needed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top