|
 |
access thread: Opening form based on a specific field
Message #1 by "Keith Munson" <klmunson77@y...> on Tue, 26 Nov 2002 15:42:23
|
|
Hey all,
I am having a little bit of a problem trying to figure out how to connect
two forms together using the common field. My first form is a basic
lookup field on a persons Name. You get the results of the query that
displays the person's first and last name along with the office room
number. I then have an additional form that keeps track of all the
inventory (ex. computers, printers, etc..). I am then wanting to open the
second form (Inventory) to display all of the specific information
assigned to the person. Again it should be linked by the Room Number. One
room number per person. Does anybody have any suggestion on how to get
this accomplished. I am a newby at access so full detail would work best.
Thanks in advance.
Keith
Message #2 by "Carnley, Dave" <dcarnley@a...> on Tue, 26 Nov 2002 10:44:27 -0600
|
|
on your first form add a command button with an appropriate label
("Inventory..." or something). In the code for that button, open the form
passing the form criteria as the ID numbers of the record you want to see.
OK, here's how you would do that
Construct your inventory form with a recordsource based on the inventory
table or a query on that table, however you need to do it. Don't worry
about linking or filtering it at this point... build it to do what you want
it to do with all the fields etc that you need.
Now, in the code for your Inventory button on the first form, put a stmt
like this:
docmd.openform FormName:="InventoryFormName",
WhereCondition:="RoomNumber="&Form1!txtRoomNumber
Access will take the string that you assign to "WhereCondition" and include
that with the record source, so make sure the recordsource for the inventory
form (a query or table whichever you use) includes the room number field.
I hope this helps!
David Carnley
-----Original Message-----
From: Keith Munson [mailto:klmunson77@y...]
Sent: Tuesday, November 26, 2002 9:42 AM
To: Access
Subject: [access] Opening form based on a specific field
Hey all,
I am having a little bit of a problem trying to figure out how to connect
two forms together using the common field. My first form is a basic
lookup field on a persons Name. You get the results of the query that
displays the person's first and last name along with the office room
number. I then have an additional form that keeps track of all the
inventory (ex. computers, printers, etc..). I am then wanting to open the
second form (Inventory) to display all of the specific information
assigned to the person. Again it should be linked by the Room Number. One
room number per person. Does anybody have any suggestion on how to get
this accomplished. I am a newby at access so full detail would work best.
Thanks in advance.
Keith
Message #3 by "Steve Klein" <Stephen@K...> on Wed, 27 Nov 2002 09:49:15 -0000
|
|
Access has a wizard for this. On the button wizard select form operations
and then open form. The wizard will ask you 'do you want to show all
records or a selection. Once you have selected the selection option it will
ask you to link the fields.
I recommend that you examine the code behind the button when you have
finished as it will help you see what you have done for next time
Steve K
-----Original Message-----
From: Keith Munson [mailto:klmunson77@y...]
Sent: 26 November 2002 15:42
To: Access
Subject: [access] Opening form based on a specific field
Hey all,
I am having a little bit of a problem trying to figure out how to connect
two forms together using the common field. My first form is a basic
lookup field on a persons Name. You get the results of the query that
displays the person's first and last name along with the office room
number. I then have an additional form that keeps track of all the
inventory (ex. computers, printers, etc..). I am then wanting to open the
second form (Inventory) to display all of the specific information
assigned to the person. Again it should be linked by the Room Number. One
room number per person. Does anybody have any suggestion on how to get
this accomplished. I am a newby at access so full detail would work best.
Thanks in advance.
Keith
|
|
 |