Help with linking multiple forms

  • Thread starter Thread starter DYale
  • Start date Start date
D

DYale

Guest
Hello,

I am using multiple forms to enter some data. When I enter the data in the second form and go back to the main (first) entry form it always goes back to the first record. Also when I am at a record at the first form and go to the second form it always starts at the first record. Is there a way to make the two forms match the record I am entering. I am entering data into the same table. I needed to use two forms because I could not fit all the information on one form. Thanks
 
A thought for you......

Have you looked into using a tabbed form? Works very well when you have more fields then will fit onto the size form you are using, and no need to do any linking.
 
There is, provided that all forms you want to link have 1 field in common, for example a clientnumber, ordernumber, etc...

I don't know how your database is set up, but I assume that you open the second form with a button on your first form. When you use the wizard to create the button, you can create this link.

You can also change the VB-code behind the button if you prefer this:

Code:
Private Sub Button2_Click()
On Error GoTo Err_Button2_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Form2"
    
    stLinkCriteria = "[Clientnumber]=" & "'" & Me![Clientnumber] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Button2_Click:
    Exit Sub

Err_Button2_Click:
    MsgBox Err.Description
    Resume Exit_Button2_Click

End Sub

Note: This is the code that is generated by using the wizard for creating buttons.

If you want me to take a look at your DB, send me a PM.

Greetz,

Seth
 
Last edited:

Users who are viewing this thread

Back
Top Bottom