help! trying to link IDs b/w parent frm and child frm

Status
Not open for further replies.

access account

Registered User.
Local time
Today, 13:51
Joined
Jun 4, 2012
Messages
14
Hi! I have a parent frm that uses a command button to open a child form with the code

Code:
Private Sub Pathophysiology_command_Click()
On Error GoTo Err_Pathophysiology_command_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Secondary Nutrition Information (Pathophysiology)"
    
    stLinkCriteria = "[ID]=" & Me![ID]
    DoCmd.OpenForm stDocName

Exit_Pathophysiology_command_Click:
    Exit Sub

Err_Pathophysiology_command_Click:
    MsgBox Err.Description
    Resume Exit_Pathophysiology_command_Click
    
End Sub

the child form has command buttons that go to the previous/next record. These buttons work if I access the child form through the parent form if the code is written like this:

Code:
Private Sub Previous_Disease_Condition_Button_Click()
On Error GoTo Err_Previous_Disease_Condition_Button_Click

    DoCmd.GoToRecord , , acPrevious
    
Exit_Previous_Disease_Condition_Button_C:
    Exit Sub

Err_Previous_Disease_Condition_Button_Click:
    MsgBox Err.Description
    Resume Exit_Previous_Disease_Condition_Button_C
    
End Sub

I would sincerly appreciate the help if anyone can assist me with finding a way to link the ID label/textbox on the parent form with the ID label/textbox on the child form. (I.e.: so that if I am on the parent form and it reads ID#3, when I click the command button to pull up the child form, it will pull up the child form with ID#3. If I want to look for a new ID on the child form, I can use the previous/next buttons).

I am very new to access 2003. I need help :banghead:
 
Status
Not open for further replies.

Users who are viewing this thread

Back
Top Bottom