Can I link 3 Forms?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to link 3 forms with different employee information. I have
hyperlinks on each form, but when I switch from one form to the other, the
first record comes up rather than information on the one employee I am
researching. My primary key for all 3 forms is employee number.
Can I link my three forms (Personal Information, Payroll, and Awards) so for
example, I can look at "Steve's" payroll and click on my hyperlink and see
"Steve's" personal information?
 
Use subforms for information like awards as the employee may have more than
one award and multiple pay changes.
 
You could include all the data in one form with tabs or subforms. If you
want to open another form and go to the specific record, the wizard will do
that for you . It will ask you to define which field contains the record
number.

I don't have an example of doing this with forms, but I do have an example
that opens a report to the appropriate record. Maybe you can modify it to
meet your needs...


Private Sub cmdPrint_Click()

Dim strWhere As String

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to print

MsgBox "Select a record to print"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.



See also: http://allenbrowne.com/casu-15.html
 
Back
Top