J
jon
Hi
I am unsure how to code the following
the table I am working on is Baan
I am selecting the record using the orderNo field
but depending if the field IcyDate empty or not I will open different forms
the code I have in the event call at the moment is below and where I have
put the ***** is where I need an if statement to see if the field IcyDate is
empty or not
Private Sub But_SelONo_Click()
On Error GoTo Err_But_SelONo_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim intcount As Integer
intcount = DLookup("[Count-O-N]", "[Qu-cmm-countorders2]") ' the query
this refers to counts the number of orders there are against this order no
If intcount = 0 Then
MsgBox "Not a valid order No: or no order No entered." & " Please re
enter." 'If there are none it displays a message box
ElseIf intcount = 1 Then
*****
stDocName = "CmmBaanEntry"
stLinkCriteria = "[OrderNo]=" & Me![Txt_reqONo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
If dateIcyBaan = VBA.date() Then
End If
DoCmd.Close acForm, "fr-cmm-select-order" ' if there is one
it will open the baan form with the oder loaded
ElseIf intcount > 1 Then ' if there is more
than 1 oder it opens a list of oders so the correct order can be selected
stDocName = "Frm-cmm-Select-stage"
stLinkCriteria = "[OrderNo]=" & Me![Txt_reqONo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "fr-cmm-select-order"
End If
Exit_But_SelONo_Click:
Exit Sub
Err_But_SelONo_Click:
MsgBox Err.Description
Resume Exit_But_SelONo_Click
End Sub
Thanks
Jon
I am unsure how to code the following
the table I am working on is Baan
I am selecting the record using the orderNo field
but depending if the field IcyDate empty or not I will open different forms
the code I have in the event call at the moment is below and where I have
put the ***** is where I need an if statement to see if the field IcyDate is
empty or not
Private Sub But_SelONo_Click()
On Error GoTo Err_But_SelONo_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim intcount As Integer
intcount = DLookup("[Count-O-N]", "[Qu-cmm-countorders2]") ' the query
this refers to counts the number of orders there are against this order no
If intcount = 0 Then
MsgBox "Not a valid order No: or no order No entered." & " Please re
enter." 'If there are none it displays a message box
ElseIf intcount = 1 Then
*****
stDocName = "CmmBaanEntry"
stLinkCriteria = "[OrderNo]=" & Me![Txt_reqONo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
If dateIcyBaan = VBA.date() Then
End If
DoCmd.Close acForm, "fr-cmm-select-order" ' if there is one
it will open the baan form with the oder loaded
ElseIf intcount > 1 Then ' if there is more
than 1 oder it opens a list of oders so the correct order can be selected
stDocName = "Frm-cmm-Select-stage"
stLinkCriteria = "[OrderNo]=" & Me![Txt_reqONo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "fr-cmm-select-order"
End If
Exit_But_SelONo_Click:
Exit Sub
Err_But_SelONo_Click:
MsgBox Err.Description
Resume Exit_But_SelONo_Click
End Sub
Thanks
Jon