J
jeff gilstrap
I am trying to use an "If " statement to open up either a
customer form or supplier form when I click on a button
from a summary form. The summary form is populated using
a union query from a supplier table and customer table.
If the "customer number" (which the union query is using
for either a customer number or supplier number) it is a
number value I would like to open a customer form. If it
is text value I would like to open a supplier form. How
can I use the if statement to specify the format of
the "customer number" to determine which form should be
opened? The code I need help on to open the form is as
follows. Thanks, Jeff G.
Private Sub MoreInfo_Click()
On Error GoTo Err_MoreInfo_Click
Dim stDocName As String
Dim stLinkCriteria As String
******this is what I could use help on *************
If [Customer Number] is a number format Then
stDocName = "Customers"
stLinkCriteria = "[Customer Number]=" & "'" & Me!
[Customer Number] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else [Customer Number] is a text format
stDocName = "Suppliers"
stLinkCriteria = "[Supplier Number]=" & "'" & Me!
[Customer Number] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_MoreInfo_Click:
Exit Sub
Err_MoreInfo_Click:
MsgBox Err.Description
Resume Exit_MoreInfo_Click
End Sub
customer form or supplier form when I click on a button
from a summary form. The summary form is populated using
a union query from a supplier table and customer table.
If the "customer number" (which the union query is using
for either a customer number or supplier number) it is a
number value I would like to open a customer form. If it
is text value I would like to open a supplier form. How
can I use the if statement to specify the format of
the "customer number" to determine which form should be
opened? The code I need help on to open the form is as
follows. Thanks, Jeff G.
Private Sub MoreInfo_Click()
On Error GoTo Err_MoreInfo_Click
Dim stDocName As String
Dim stLinkCriteria As String
******this is what I could use help on *************
If [Customer Number] is a number format Then
stDocName = "Customers"
stLinkCriteria = "[Customer Number]=" & "'" & Me!
[Customer Number] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else [Customer Number] is a text format
stDocName = "Suppliers"
stLinkCriteria = "[Supplier Number]=" & "'" & Me!
[Customer Number] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_MoreInfo_Click:
Exit Sub
Err_MoreInfo_Click:
MsgBox Err.Description
Resume Exit_MoreInfo_Click
End Sub