I am not sure why you are doing the filtering in a second step
Private Sub OpenSeizureForm()
dim stFilter as String
If Me.NewRecord Then
'Open form in dataentry mode
DoCmd.OpenForm "Seizures", acNormal, , , acFormAdd, acWindowNormal, Me.incidentNum & "&Episode"
Else
' open and filter form
stFilter = "[IncidentNum] = '" & Me.[incidentNum] & "' And [SourceTable] = 'Episode'"
DoCmd.OpenForm "Seizures", acNormal, , stFilter, , acWindowNormal, Me.incidentNum & "&Episode"
End If
End Sub
Private Sub Form_Load
Dim argSplit() As String
argSplit = Split(CStr(Me.OpenArgs), "&")
'Set the DefaultValue which means new records will have these values
Me.txtIncidentNum.DefaultValue = CStr(argSplit(0))
Me.sourceTable.DefaultValue = CStr(argSplit(1))
End Sub ChrisPadgham
Posting Pro in Training
413 posts since Sep 2009
Reputation Points: 102
Solved Threads: 78