Linking forms (not subform)

SteveI

Registered User.
Local time
Today, 17:27
Joined
Apr 22, 2012
Messages
20
I want to access Form 2 via Form 1 by means of a button.

The information on Form 1 (contains a recipe) is related to form two and exists via a valid relationship within the tables.

Form2 contains information about the recipe i.e. instructions on how to make the recipe in form in strict sequence.

I want to insert a button on form 1 that will take me to the mixing instructions on form 2 immediately. The problem I have having is that I do not know how to instruct the button to select the same record that is related to Form 1.
 
You can do this by using the wizard to create the button.
The code produced will look some like this:
Code:
Private Sub Command8_Click()
On Error GoTo Err_Command8_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "[COLOR=red][B]NameOfFormToBeOpened[/B][/COLOR]"
    
    stLinkCriteria = "[[B][COLOR=#ff0000]LinkOnFirstForm[/COLOR][/B]]=" & Me![[B][COLOR=#ff0000]LinkOnSecondForm[/COLOR][/B]]
    DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command8_Click:
    Exit Sub
Err_Command8_Click:
    MsgBox err.Description
    Resume Exit_Command8_Click
    
End Sub
 

Users who are viewing this thread

Back
Top Bottom