Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Forms Criteria

Status
Not open for further replies.

Bickertk

Programmer
Aug 26, 2002
23
0
0
GB
I have made a form to preview car accident information only. On it I have attached a button that when pressed allows a popup form to input new accident information.

When it pops up I would like this form to already have the ID Number of the vehicle in the preview screen on it. Can anyone tell me how to link the form so that this can happen?

They are two separate forms at the moment.

Thanks for any help.
 
You could make the second form a sub-form of the first, and then for each new piece of information you add, a new record in the information table will be added.

For this, you need a table with all the vehicle/date/place etc. information and a second table with the vehicle, date and "other information" which will be on the sub-form. The two tables will have a relationship based on the vehicle and date (I guess that no vehicle will have more than one accident on the dame day!) which will be a one-to-many relationship (vehicle-to-information.)

Hope this helps.
 
Another way would be to send the id number as an argument using OpenArgs.

When opening the form, use code like this:
Code:
Dim szArgs as string
szArgs = [ID Number]
DoCmd.OpenForm "frmNewAccident", acNormal, , , , acDialog, szArgs

For the form that is being opened, use code like this:
Code:
Private Sub Form_Load()
    If IsNull(Me.OpenArgs)=False Then
        [ID Number] = Me.OpenArgs
    End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top