I have my query set up and all works fine excepy I want to set up the three check boxes at the end of the code to include all the values I get no results from the query when I check more than one. Do I need to requery after each checkbox? I am not sure how to go about this.
below is the code thanks
Jim
Private Sub Run_NOD_Click()
On Error GoTo Err_Run_NOD_Click
Dim stDocName As String
stDocName = "Ex_Cause_ByNOD"
'Selection Criteria (Should come up in one sheet)
'> Date from
'> Date to
'> Catalog #
'> Vendor
'> Buyer Code
'>
'> Reports:
'> Include the following
'> Item
'> Desc
'> Date
'> Cause
'> Serial Lot
'> WHSE
'> Qty
'> Amount
'> Storage Code
'> Buyer Code
'> RCV
'> SRC
'> NOD
'> Report 1 Sort selected items by dollar amount
'> Report 2 Sort selected items by Catalog #
'> Report 3 Sort by Vendor
'> Report 4 Sort by Buyer Code
'> Report 5 Sort by RCV
'> Report 6 Sort by SRC
Dim sWhere As String
'make sure we have an end date and a start date - 'required.
If IsNull(Me!StartDate) = True Then
MsgBox "You must enter a start date", , "Expired Report Generator"
End If
If IsNull(Me!EndDate) = True Then
MsgBox "You must enter an end date.", , "Expired Report Generator"
End If
sWhere = "qryEx_CauseByNOD.Date >= #" & Me!StartDate & "# and qryEx_CauseByNOD.Date <= #" & Me!EndDate & "#"
If IsNull(Me!Warehouse) = False Then
sWhere = sWhere & " and qryEx_CauseByNOD.WHSE = '" & Me!Warehouse & "'"
End If
If IsNull(Me![Catalog#]) = False Then
sWhere = sWhere & " and qryEx_CauseByNOD.[Item] = '" & Me![Catalog#] & "'"
End If
If IsNull(Me!Vendor) = False Then
sWhere = sWhere & " and qryEx_CauseByNOD.Vendor = '" & Me!Account & "'"
End If
If IsNull(Me!BuyerCode) = False Then
sWhere = sWhere & " and qryEx_CauseByNOD.[Buyer Code] = '" & Me![BuyerCode] & "'"
End If
If IsNull(Me!RCV) = False Then
sWhere = sWhere & " and qryEx_CauseByNOD.[RCV] = " & Me![RCV] & ""
End If
If IsNull(Me!SRC1) = False Then
sWhere = sWhere & " and qryEx_CauseByNOD.[SRC] = " & Me![SRC1] & ""
End If
'If IsNull(Me![cboNOD]) = False Then
' sWhere = sWhere & " and qryEx_CauseByNOD.[NOD] = '" & Me![cboNOD] & "'"
'End If
If (Me![ChkNODY]) = True Then
sWhere = sWhere & " and qryEx_CauseByNOD.[NOD] = '" & "Y" & "'"
End If
If (Me![ChkNODN]) = True Then
sWhere = sWhere & " and qryEx_CauseByNOD.[NOD] = '" & "N" & "'"
End If
If (Me![chkNODX]) = True Then
sWhere = sWhere & " and qryEx_CauseByNOD.[NOD] = '" & "X" & "'"
End If
DoCmd.OpenReport stDocName, acViewPreview, , sWhere
'DoCmd.OpenReport stDocName, acPreview
Exit_Run_NOD_Click:
Exit Sub
Err_Run_NOD_Click:
MsgBox Err.Description
Resume Exit_Run_NOD_Click
End Sub
below is the code thanks
Jim
Private Sub Run_NOD_Click()
On Error GoTo Err_Run_NOD_Click
Dim stDocName As String
stDocName = "Ex_Cause_ByNOD"
'Selection Criteria (Should come up in one sheet)
'> Date from
'> Date to
'> Catalog #
'> Vendor
'> Buyer Code
'>
'> Reports:
'> Include the following
'> Item
'> Desc
'> Date
'> Cause
'> Serial Lot
'> WHSE
'> Qty
'> Amount
'> Storage Code
'> Buyer Code
'> RCV
'> SRC
'> NOD
'> Report 1 Sort selected items by dollar amount
'> Report 2 Sort selected items by Catalog #
'> Report 3 Sort by Vendor
'> Report 4 Sort by Buyer Code
'> Report 5 Sort by RCV
'> Report 6 Sort by SRC
Dim sWhere As String
'make sure we have an end date and a start date - 'required.
If IsNull(Me!StartDate) = True Then
MsgBox "You must enter a start date", , "Expired Report Generator"
End If
If IsNull(Me!EndDate) = True Then
MsgBox "You must enter an end date.", , "Expired Report Generator"
End If
sWhere = "qryEx_CauseByNOD.Date >= #" & Me!StartDate & "# and qryEx_CauseByNOD.Date <= #" & Me!EndDate & "#"
If IsNull(Me!Warehouse) = False Then
sWhere = sWhere & " and qryEx_CauseByNOD.WHSE = '" & Me!Warehouse & "'"
End If
If IsNull(Me![Catalog#]) = False Then
sWhere = sWhere & " and qryEx_CauseByNOD.[Item] = '" & Me![Catalog#] & "'"
End If
If IsNull(Me!Vendor) = False Then
sWhere = sWhere & " and qryEx_CauseByNOD.Vendor = '" & Me!Account & "'"
End If
If IsNull(Me!BuyerCode) = False Then
sWhere = sWhere & " and qryEx_CauseByNOD.[Buyer Code] = '" & Me![BuyerCode] & "'"
End If
If IsNull(Me!RCV) = False Then
sWhere = sWhere & " and qryEx_CauseByNOD.[RCV] = " & Me![RCV] & ""
End If
If IsNull(Me!SRC1) = False Then
sWhere = sWhere & " and qryEx_CauseByNOD.[SRC] = " & Me![SRC1] & ""
End If
'If IsNull(Me![cboNOD]) = False Then
' sWhere = sWhere & " and qryEx_CauseByNOD.[NOD] = '" & Me![cboNOD] & "'"
'End If
If (Me![ChkNODY]) = True Then
sWhere = sWhere & " and qryEx_CauseByNOD.[NOD] = '" & "Y" & "'"
End If
If (Me![ChkNODN]) = True Then
sWhere = sWhere & " and qryEx_CauseByNOD.[NOD] = '" & "N" & "'"
End If
If (Me![chkNODX]) = True Then
sWhere = sWhere & " and qryEx_CauseByNOD.[NOD] = '" & "X" & "'"
End If
DoCmd.OpenReport stDocName, acViewPreview, , sWhere
'DoCmd.OpenReport stDocName, acPreview
Exit_Run_NOD_Click:
Exit Sub
Err_Run_NOD_Click:
MsgBox Err.Description
Resume Exit_Run_NOD_Click
End Sub