G
Gulf Coast Electric
I am trying to make this form FPayments open the form Timecards and link the
criteria so that the matching record opens.
It opens the correct record, but when there is no matching record it still
opens the form.
How can I correct This ? Thanks, Dave
Dim stDocName As String
Dim stLinkCriteria As String
Dim VarX As Variant
stDocName = "TimeCards"
stLinkCriteria = "[Repair Order Number]=" & "'" & Me![Order ID] & "'"
VarX = DLookup("[Order ID]", "Orders", "[Order ID] =
Forms![FPayments]![Order ID]")
If IsNull(VarX) Then
MsgBox "No Time Card Found" 'Changed 4/7/03
Else: DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
criteria so that the matching record opens.
It opens the correct record, but when there is no matching record it still
opens the form.
How can I correct This ? Thanks, Dave
Dim stDocName As String
Dim stLinkCriteria As String
Dim VarX As Variant
stDocName = "TimeCards"
stLinkCriteria = "[Repair Order Number]=" & "'" & Me![Order ID] & "'"
VarX = DLookup("[Order ID]", "Orders", "[Order ID] =
Forms![FPayments]![Order ID]")
If IsNull(VarX) Then
MsgBox "No Time Card Found" 'Changed 4/7/03
Else: DoCmd.OpenForm stDocName, , , stLinkCriteria
End If