Sub Form Issue
How this is working is that, when i choose the site, the vendor changes and the PO changes to the fist purchase order from that vendor. but if i scroll through the other vendors, the PO stays the same. Heres the Code for the New Vendor:
Option Compare Database
Sub Form_Current()
On Error GoTo Form_Current_Err
If ChildFormIsOpen() Then FilterChildForm
Form_Current_Exit:
Exit Sub
Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit
End Sub
Sub ToggleLink_Click()
On Error GoTo ToggleLink_Click_Err
If ChildFormIsOpen() Then
CloseChildForm
Else
OpenChildForm
FilterChildForm
End If
ToggleLink_Click_Exit:
Exit Sub
ToggleLink_Click_Err:
MsgBox Error$
Resume ToggleLink_Click_Exit
End Sub
Private Sub FilterChildForm()
If Me.NewRecord Then
Forms![PO filter].DataEntry = True
Else
Forms![PO filter].Filter = "[Vendor Code] = " & Me.[Vendor Code]
Forms![PO filter].FilterOn = True
End If
End Sub
Private Sub OpenChildForm()
DoCmd.OpenForm "PO filter"
If Not Me.[ToggleLink] Then Me![ToggleLink] = True
End Sub
Private Sub CloseChildForm()
DoCmd.Close acForm, "PO filter"
If Me![ToggleLink] Then Me![ToggleLink] = False
End Sub
Private Function ChildFormIsOpen()
ChildFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "PO filter") And acObjStateOpen) <> False
End Function
Heres the code for the PO in case you need it
Option Compare Database
Sub Form_Current()
Dim ParentDocName As String
On Error Resume Next
ParentDocName = Me.Parent.Name
If Err <> 0 Then
GoTo Form_Current_Exit
Else
On Error GoTo Form_Current_Err
Me.Parent![PO Subform].Requery
End If
Form_Current_Exit:
Exit Sub
Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit
End Sub

