By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,650 Members | 812 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,650 IT Pros & Developers. It's quick & easy.

how to display report for specific date

P: 2
i have made a software for medicine distributor
i wanna show the reports for orders placed to a pharmaceutical company within specific period of time
i wrote
rs.Open "Select * from placedorder where PLACE_DATE between " & Txtdate.Text & " and " & txtdateto.Text & " ", con, 3, 3


but im getting all records from the db being displayed during run time ,
but
i want records between specific date that user enters during run time
so please any one help me out with the query
Apr 16 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 5K+
P: 8,434
I believe the problem is probably related to the delimiters (or lack of them) around your date values. See this reference, and this one may also be of some use.
Apr 17 '07 #2

100+
P: 375
i have made a software for medicine distributor
i wanna show the reports for orders placed to a pharmaceutical company within specific period of time
i wrote
rs.Open "Select * from placedorder where PLACE_DATE between " & Txtdate.Text & " and " & txtdateto.Text & " ", con, 3, 3


but im getting all records from the db being displayed during run time ,
but
i want records between specific date that user enters during run time
so please any one help me out with the query
I assume that your backend is MS-Access.
Secondly you have to format your textbox to date format, Better use DtPicker control
Then put down the query as
rs.Open "Select * from placedorder where PLACE_DATE >=#" & DTPicker1.Value & "# and PLACE_DATE<=# " & DTPicker2.Value & "# ",con, adOpenDynamic, adLockOptimistic


In case your backend is sql server replace # with '
Good luck
Apr 17 '07 #3

Expert 5K+
P: 8,434
I think the SQL is neater and slightly easier to read if you use the Between keyword, as in the original code. Not that it would make any difference to the functionality, of course.
Apr 17 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.