forms

  • Thread starter Thread starter Marie
  • Start date Start date
M

Marie

Hello,

I have created a database to track hardware. I have
created a table called Location that contains the
following fields loc_id (which is a autonumber and is my
primary key) then bldg, room and cubicle. Loc_Id is then a
forein key in another table called asset_details. I
created a form that uses information from the
asset_details table.

I would like the form to tie a piece of hardware to a
certain location which would include a bldg, room and
cubicle. How would I go about doing this if I am using a
auto number?
 
All you need to add is a subform based on the Asset_Details table. When
you navigate records in the main form, those in the subform will change
reflecting Assets in a particular location.
When you enter a new item in the subform, it will automatically use the
Loc_Id from the main form, since this is what the forms are linked by.
If you make a new Location, the autonumber will be generated before you
insert any child records, so it will work just fine.

Pavel
 
If I do use a subform, can I only create one for the asset
location field. Since I have already created my form not
using any subforms can I add a subform only for the asset
location? When I try to do this, I use the control wizard
and add a sub-form to my form. Then the wizard dialog box
comes up and it asks me to choose a table, I tried
choosing the Location table and then selecting all its
fields. Then it asks me if I would like to define fields
from my main form to my sub-form. I leave this blank and
I choose finish. This shows me all the records in this
table but I still don't know how the user will be able to
choose the location?
 
Uh, I am confused.
The way I understand your database, you have the main form, which allows
you to choose Location. This form may have all the information about the
location - building, cubicle, etc.
Now, make another form, AssetDetails, in design view, base it on the
Asset_Details table and include those fields you need for every asset. I
suggest that you try to lay it out in kind of a spreadsheet style, so
that you can use it in continuous view.
Now, make a subform control on the main form and choose Use existing
form. Select the AssetDetails form. It will get put in. All you have to
do now is make sure that parent and child field is selected properly for
the subform control - Loc_Id.
The idea is, for one-to-many relationship (one location, many asset
details) your main form shows the One side (locations), and the subform
shows the filtered Many side (asset details). When you go back and forth
in records of the main form, your subform will show only those Asset
details that belong to the Location chosen on the Main form.

Hope this helps,
Pavel
 
Back
Top