Martyh
Registered User.
- Local time
- Today, 17:24
- Joined
- May 2, 2000
- Messages
- 196
Hi all,
I have button on my form which does the following:
	
	
	
		
When I run this code the following happens:
		
		
	
	
		 
	
When I enter the date (04/15/2022) I get:
		 
	
the incorrect answer!!
The parameter value and SQL query is given in the Report record source as:
PARAMETERS TDate DateTime; SELECT stayID, ProNum, ParticipantLastName, BookedIN, BookedOUT, RoomBedID, RoomNo, Bed FROM qsRoomsBookedForEmergency WHERE ((((Abs([Tdate]-[BookedIN])<[Days]) And ([TDate]-[BookedIN]>=0))=True));
And when I independantly run the report (of course I have to put in the parameter) it comes up with the appropriate results as follows:
		 
	
So... I would like to use the form to specify Me.dteDate and then run the report. What am I doing wrong?
Perplexed,
Marty H.
 I have button on my form which does the following:
		Code:
	
	
	Private Sub cmdPrintRollCall_Click()
On Error GoTo Err_cmdPrintRollCall_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "rptRollCall1stXR-12"
stLinkCriteria = "TDate = " & Me.dteDate   'the date on the Form
DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria
Err_cmdPrintRollCall_Click:
End SubWhen I run this code the following happens:
When I enter the date (04/15/2022) I get:
the incorrect answer!!
The parameter value and SQL query is given in the Report record source as:
PARAMETERS TDate DateTime; SELECT stayID, ProNum, ParticipantLastName, BookedIN, BookedOUT, RoomBedID, RoomNo, Bed FROM qsRoomsBookedForEmergency WHERE ((((Abs([Tdate]-[BookedIN])<[Days]) And ([TDate]-[BookedIN]>=0))=True));
And when I independantly run the report (of course I have to put in the parameter) it comes up with the appropriate results as follows:
So... I would like to use the form to specify Me.dteDate and then run the report. What am I doing wrong?
Perplexed,
Marty H.
 
	 
 
		 
 
		 
 
		 
 
		 
 
		