Datareport????

giana
01-08-2004, 02:38 PM
Hi, I have a form with 2 textboxes where the user inputs the initial date and the finale date. the form should then generates a report based on the query with the information inputed by the user. Problem: the form opens and it shows nothing, and I'm sure there are records in the db for the dates I input. With error trapping I get an error 0 and no description

this is the query:
strSQL = "SELECT Name_Last, Name_First, GroupName, Date_In, Housing_Unit, Date_Out FROM CONTACTS" & _
" WHERE Date_In >= #" & strDateIn & "# AND Date_Out <= #" & strDateOut & "# "

any idea?

airski
01-08-2004, 11:14 PM
Use the "BETWEEN...AND..." statement in your sql statement rather then < and >. Check if the date is BETWEEN the start date and the end date you entered in your text boxes.

Dennis DVR
01-09-2004, 04:30 AM
Hi, I have a form with 2 textboxes where the user inputs the initial date and the finale date. the form should then generates a report based on the query with the information inputed by the user. Problem: the form opens and it shows nothing, and I'm sure there are records in the db for the dates I input. With error trapping I get an error 0 and no description

this is the query:
strSQL = "SELECT Name_Last, Name_First, GroupName, Date_In, Housing_Unit, Date_Out FROM CONTACTS" & _
" WHERE Date_In >= #" & strDateIn & "# AND Date_Out <= #" & strDateOut & "# "

any idea?

the question is how did bind your data report?

giana
01-09-2004, 06:39 AM
I've used BETWEEN ...AND... and the result is the same.
In my report i've got 5 textboxes bound to the data that I use iin the query. It worked with other reports, so I don't understand why it's not working here.

Shurik12
01-09-2004, 06:54 AM
Hi,
Could you try formatting the variables this way:

" WHERE Date_In >= #" & Format(strDateIn,"yyyy-mm-dd") & "# AND Date_Out <= #" & Format(strDateOut,"yyyy-mm-dd") & "#"

giana
01-09-2004, 07:30 AM
Hi,
Could you try formatting the variables this way:

" WHERE Date_In >= #" & Format(strDateIn,"yyyy-mm-dd") & "# AND Date_Out <= #" & Format(strDateOut,"yyyy-mm-dd") & "#"


Thanks Shurik for the reply. I tried but is not working. Always getting the same error. This is an example of the query when I lunch it:

SELECT Name_Last, Name_First, GroupName, Date_In, Housing_Unit, Date_Out
FROM CONTACTS
WHERE Date_In >= #2003-01-02# AND Date_Out <= #2005-01-02#

airski
01-09-2004, 07:38 AM
After your "Where...." clause, use the "GROUP BY..." clause:


Select Name_Last, Name_First, GroupName, Date_In, Housing_Unit, Date_Out
FROM CONTACTS
WHERE Date_In >= #2003-01-02# And Date_Out <= #2005-01-02#
GROUP BY Name_Last, Name_First, GroupName, Date_In, Housing_Unit, Date_Out;

giana
01-09-2004, 07:41 AM
Nope, same error.
what is this error 0 anyway?

giana
01-09-2004, 10:08 AM
Ok guys, I solved it. The problem was actually in the database. Had to set the date field as date

thanks

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum