P
PHisaw
Hi,
Can anyone please tell me why the following code is not working?
Private Sub CmdViewSelection_Click()
Dim stWhere As String
Dim stDoc As String
stDoc = "rSalesman"
If Not IsNull(Me.CboSlsp) Then
stWhere = "Salesman= """ & Me.CboSlsp & """"
End If
If Not IsNull(Me.CboStage) Then
stWhere = "Stage= """ & Me.CboStage & """"
End If
If Not IsNull(Me.CboStatus) Then
stWhere = "Status= """ & Me.CboStatus & """"
End If
If Not IsNull(Me.CboProbability) Then
stWhere = "Probability= " & Me.CboProbability & ""
End If
DoCmd.OpenReport stDoc, acViewPreview, , stWhere
End Sub
Here's the problem: I can enter any combination of criteria and get the
correct records, except when I enter Status. Status will return records
related to the code in the combo box, but doesn't recognize the other combo
boxes when they are selected. It will return all "open" orders, but if I
select open orders for a specific salesman - it returns all open orders.
I've ran thru scenarios for all other combinations without using Status and
those combinations will return correct records.
Any help is greatly appreciated!
Thanks,
Phisaw
Can anyone please tell me why the following code is not working?
Private Sub CmdViewSelection_Click()
Dim stWhere As String
Dim stDoc As String
stDoc = "rSalesman"
If Not IsNull(Me.CboSlsp) Then
stWhere = "Salesman= """ & Me.CboSlsp & """"
End If
If Not IsNull(Me.CboStage) Then
stWhere = "Stage= """ & Me.CboStage & """"
End If
If Not IsNull(Me.CboStatus) Then
stWhere = "Status= """ & Me.CboStatus & """"
End If
If Not IsNull(Me.CboProbability) Then
stWhere = "Probability= " & Me.CboProbability & ""
End If
DoCmd.OpenReport stDoc, acViewPreview, , stWhere
End Sub
Here's the problem: I can enter any combination of criteria and get the
correct records, except when I enter Status. Status will return records
related to the code in the combo box, but doesn't recognize the other combo
boxes when they are selected. It will return all "open" orders, but if I
select open orders for a specific salesman - it returns all open orders.
I've ran thru scenarios for all other combinations without using Status and
those combinations will return correct records.
Any help is greatly appreciated!
Thanks,
Phisaw