If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Report filter problem
I have a command button called TodaysReport and an unbound textbox called
txtDate whos defauld value is set to Date(). I need the on click event property of the button to filter the report only for the records whos dates are the same as that in the textbox. The name of field in the record source of the report is [ReceivedOn]. This works perfectly with any other data type, but not with the date/time data type. I get a blank report everytime. The format and input mask of the date in all three controls meaning on the report, record source and unbound textbox are the same. Why do I get a blank report??? ?? here is my code. Private Sub TodaysReport_Click() Dim stDocName As String Dim strWhere As String stDocName = "Report" strWhere = "ReceivedOn=#" & Me.txtDate & "#" DoCmd.OpenReport stDocName, acPreview, , strWhere End Sub -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ports/200708/1 |
#2
|
|||
|
|||
Report filter problem
"injanib via AccessMonster.com" u35551@uwe wrote in message
news:76ce3b8919a66@uwe... I have a command button called TodaysReport and an unbound textbox called txtDate whos defauld value is set to Date(). I need the on click event property of the button to filter the report only for the records whos dates are the same as that in the textbox. The name of field in the record source of the report is [ReceivedOn]. This works perfectly with any other data type, but not with the date/time data type. I get a blank report everytime. The format and input mask of the date in all three controls meaning on the report, record source and unbound textbox are the same. Why do I get a blank report??? ?? here is my code. Private Sub TodaysReport_Click() Dim stDocName As String Dim strWhere As String stDocName = "Report" strWhere = "ReceivedOn=#" & Me.txtDate & "#" DoCmd.OpenReport stDocName, acPreview, , strWhere End Sub -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ports/200708/1 Are you certain you have records that match the entered date? It may seem like an obvious question, but that has tripped up others before (myself included). If there are times with the dates stored in the database, the date string "01/01/2007" won't match the date vale "01/01/2007 11:33". Put a breakpoint on the DoCmd.OpenReport line and check the contents of strWhere. Create a query using the same source as the report, add the contents of strWhere in a WHERE clause, and see if it returns records. Carl Rapson |
Thread Tools | |
Display Modes | |
|
|