Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2006

    Unanswered: How to link a suform to another form?

    Hi everyone
    okay, I have a form called tblpatient that hosts a subform called tblBill, this table bill has a subform that is called tblMedication, it is shown in attachments,
    now, I've created another form that is called tblanalysis, I want to link it via a button or toggle click, so it will act like a subform where it will link BillID from tblBill with BillID from tblAnalysis,, how do I do that? I know how to to it using form wizard but I don't want to start from zero with the form.
    I've created another one using the wizard, copied and pasted code, but the toggle or button exists in the patient form and didn't work (didn't open the tblanalysis form), In addition when I tried to put the toggle in the tblBill form where it is supposed to be, it didn't show me a button, see the attached picture and you will find a field called togglelink, which is supposed to be a toggle!

    here is the code that didn't work when the toggle was in tblpatient form
    Sub ToggleLink_Click()
    On Error GoTo ToggleLink_Click_Err

    If ChildFormIsOpen() Then
    End If

    Exit Sub

    MsgBox Error$
    Resume ToggleLink_Click_Exit

    End Sub
    Private Sub FilterChildForm()

    If Me.NewRecord Then
    Forms![tblAnalysis].DataEntry = True
    Forms![tblAnalysis].Filter = "[BillID] = " & Me.[BillID]
    Forms![tblAnalysis].FilterOn = True
    End If

    End Sub
    Private Sub OpenChildForm()

    DoCmd.OpenForm "tblAnalysis"
    If Not Me.[ToggleLink] Then Me![ToggleLink] = True

    End Sub
    Private Sub CloseChildForm()

    DoCmd.Close acForm, "tblAnalysis"
    If Me![ToggleLink] Then Me![ToggleLink] = False

    End Sub
    Private Function ChildFormIsOpen()

    ChildFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "tblAnalysis") And acObjStateOpen) <> False

    End Function

    I would be happy to receive any helpful answers, thanks

  2. #2
    Join Date
    Aug 2006
    Oops, forgot to attach
    Attached Thumbnails Attached Thumbnails tblanlysis.PNG  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts