Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem ck BoxSort Criteria

Status
Not open for further replies.

jimbo62

Technical User
Oct 19, 2002
43
US
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 = &quot;qryEx_CauseByNOD.Date >= #&quot; & Me!StartDate & &quot;# and qryEx_CauseByNOD.Date <= #&quot; & Me!EndDate & &quot;#&quot;

If IsNull(Me!Warehouse) = False Then
sWhere = sWhere & &quot; and qryEx_CauseByNOD.WHSE = '&quot; & Me!Warehouse & &quot;'&quot;
End If

If IsNull(Me![Catalog#]) = False Then
sWhere = sWhere & &quot; and qryEx_CauseByNOD.[Item] = '&quot; & Me![Catalog#] & &quot;'&quot;
End If

If IsNull(Me!Vendor) = False Then
sWhere = sWhere & &quot; and qryEx_CauseByNOD.Vendor = '&quot; & Me!Account & &quot;'&quot;
End If

If IsNull(Me!BuyerCode) = False Then
sWhere = sWhere & &quot; and qryEx_CauseByNOD.[Buyer Code] = '&quot; & Me![BuyerCode] & &quot;'&quot;
End If

If IsNull(Me!RCV) = False Then
sWhere = sWhere & &quot; and qryEx_CauseByNOD.[RCV] = &quot; & Me![RCV] & &quot;&quot;
End If

If IsNull(Me!SRC1) = False Then
sWhere = sWhere & &quot; and qryEx_CauseByNOD.[SRC] = &quot; & Me![SRC1] & &quot;&quot;
End If

'If IsNull(Me![cboNOD]) = False Then
' sWhere = sWhere & &quot; and qryEx_CauseByNOD.[NOD] = '&quot; & Me![cboNOD] & &quot;'&quot;
'End If

If (Me![ChkNODY]) = True Then
sWhere = sWhere & &quot; and qryEx_CauseByNOD.[NOD] = '&quot; & &quot;Y&quot; & &quot;'&quot;
End If

If (Me![ChkNODN]) = True Then
sWhere = sWhere & &quot; and qryEx_CauseByNOD.[NOD] = '&quot; & &quot;N&quot; & &quot;'&quot;
End If

If (Me![chkNODX]) = True Then
sWhere = sWhere & &quot; and qryEx_CauseByNOD.[NOD] = '&quot; & &quot;X&quot; & &quot;'&quot;
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
 
please disregard ...my post is unclear

thanks Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top