Relational tables

G

Guest

I finally figured out how to have fields and/or labelboxes visible/invisible
based on value of a checkbox. However, I am having trouble with making
labelboxes visible/invisible for their respective field.

I have two tables:
Vehicle - Contains make, model, year, color, etc., of vehicle.
Primary Key = VehicleID
Service - Contains info pertaining to service to vehicles.
Primary Key = ServiceID Relational "key": VehicleID

The Primary key for each table is user input, not automatic.

Question 1:
I want a labelbox to appear when the user is having to input the ServiceID.
This labelbox will give instructions on the format to use to create the
ServiceID. I figure I will use an Event Procedure for AfterUpdate in order
to make the labebox invisible, but if there is a better way please tell me.
However, since this is the first field to be answered when a new page
(record) is displayed and the cursor is already in the ServiceID field, I am
not sure how to make the labelbox visible.

Question 2:
The VehicleID is the second field to require answering on this page. I also
have a labelbox that list the vehicle and its VehicleID so that the user
will know what to enter. How do I make this labelbox visible/invisible for
just the VehicleID field?

Question 3:
I have not proceeded to creating a query or report for these two tables.
Will the wizard see the relationship and display the fields from both tables
for me to use or do I need to do something?

I appreciate any help with this,
Les
 
G

Guest

Use the GotFocus and LostFocus event procedures of the bound controls to set
the Visible property of each label control, e.g. for VehicleID, in the former

Me.lblVehicleID.Visible = True

and in the latter:

Me.lblVehicleID.Visible = False

Do the same for the ServiceID in its GotFocus and LostFocus event procedures:

Me.lblServiceID.Visible = True

and in the latter:

Me.lblServiceID.Visible = False

To avoid having to enter the VehicleID for every Service record however, you
could use a Service subform within a Vehicle parent form. The parent form
should be in single form view, the subform can be in continuous or single
form view as you wish. The subform should be linked to the parent form on
the VehicleID fields. You then simply need to go to the relevant vehicle
record in the parent form and you can enter as many service records for that
vehicle as required in the subform. The VehicleID will be automatically
entered into the subform's underlying current record. You don't need to show
the VehicleID in a control on the subform, just the ServiceID and any other
fields from the Servoce table which need to be completed.

As regards queries and reports, if you've created a relationship between the
two tables in the relationships window, when you create a query in design
view the tables will be automatically joined in the query. You can then use
the report wizard to create a report based in the query.

Ken Sheridan
Stafford, England
 

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

Similar Threads


Top