mardukk
June 12th, 2001, 05:24 PM
Hey all.. I have this one report that has two fields in it.. Those two fields are dtmArrive (for arrival date) and dtmDepart (for departure date).. I am trying to have a form that calls this report by the date that a user chooses.. But that date needs to fall between dtmArrive and dtmDepart.. Its called a stay over report.. So if the user puts in a date and it finds that someone is going to be staying over on that date it will show this report.. This is the small code that I had before.. Please help..
Private Sub btnOK_Click() ' FJN 3/7/2001
On Error GoTo Err_btnOK_Click
Dim txtResp1 As String
txtResp1 = txtResp.Value
DoCmd.OpenReport "rptStayOver", [acViewPreview], , "dtmArrive <> # & dtmDepart <> #" & txtResp1 & "#"
DoCmd.Close acForm, "frmStayOver"
Err_btnOK_Click:
Select Case Err
Case 2501 'report cancelled, just go on
Exit Sub
Case 3075 'syntax error
MsgBox "You have entered an invalid date! ", vbCritical, "Please try again."
Exit Sub
Case Else
MsgBox "Error in btnOK_Click, error is " & Err & " - " & Err.Description, vbCritical, gstrDAHMSG
Exit Sub
End Select
End Sub
Private Sub btnOK_Click() ' FJN 3/7/2001
On Error GoTo Err_btnOK_Click
Dim txtResp1 As String
txtResp1 = txtResp.Value
DoCmd.OpenReport "rptStayOver", [acViewPreview], , "dtmArrive <> # & dtmDepart <> #" & txtResp1 & "#"
DoCmd.Close acForm, "frmStayOver"
Err_btnOK_Click:
Select Case Err
Case 2501 'report cancelled, just go on
Exit Sub
Case 3075 'syntax error
MsgBox "You have entered an invalid date! ", vbCritical, "Please try again."
Exit Sub
Case Else
MsgBox "Error in btnOK_Click, error is " & Err & " - " & Err.Description, vbCritical, gstrDAHMSG
Exit Sub
End Select
End Sub