Mansoor Ahmad
Registered User.
- Local time
- Today, 20:40
- Joined
- Jan 20, 2003
- Messages
- 140
Can sombody tell me where I am doing wrong in the following code.
Private Sub viewresults2(rptPrint As String)
Dim stWhere As String
Dim myInt As String
Dim myInd As String
myInd = CbCustomer
Select Case Me!frmRelativequeries1
Case 1
myInt = Forms![New form Sample]!Cbpartno
stWhere = "[CUSTOMER] = '" & myInd & "' And [PART NO] = '" & myInt & "'"
Case 2
myInt = Forms![New form Sample]!Cbrejcode
stWhere = "[CUSTOMER] = '" & myInd & "' And [REJ CODE] = '" & myInt & "'"
Case 3
myInt = Forms![New form Sample]!Cbliabcat
stWhere = "[CUSTOMER] = '" & myInd & "' And [CAT] = '" & myInt & "'"
Case 4
myInt = Forms![New form Sample]!Cbcustomerdefcode
stWhere = "[CUSTOMER] = '" & myInd & "' And [DEFECT CODE/COMPLAINT CODE] = '" & myInt & "'"
Case Else
stWhere = ""
End Select
DoCmd.OpenForm (rptPrint), acNormal, , stWhere
End Sub
If the customer combobox is left blank. It prompts as
'Invalid use of Null'. It works fine if I put some data in customer combobox.
Thanks
Private Sub viewresults2(rptPrint As String)
Dim stWhere As String
Dim myInt As String
Dim myInd As String
myInd = CbCustomer
Select Case Me!frmRelativequeries1
Case 1
myInt = Forms![New form Sample]!Cbpartno
stWhere = "[CUSTOMER] = '" & myInd & "' And [PART NO] = '" & myInt & "'"
Case 2
myInt = Forms![New form Sample]!Cbrejcode
stWhere = "[CUSTOMER] = '" & myInd & "' And [REJ CODE] = '" & myInt & "'"
Case 3
myInt = Forms![New form Sample]!Cbliabcat
stWhere = "[CUSTOMER] = '" & myInd & "' And [CAT] = '" & myInt & "'"
Case 4
myInt = Forms![New form Sample]!Cbcustomerdefcode
stWhere = "[CUSTOMER] = '" & myInd & "' And [DEFECT CODE/COMPLAINT CODE] = '" & myInt & "'"
Case Else
stWhere = ""
End Select
DoCmd.OpenForm (rptPrint), acNormal, , stWhere
End Sub
If the customer combobox is left blank. It prompts as
'Invalid use of Null'. It works fine if I put some data in customer combobox.
Thanks