|
-
Feb 12th, 2007, 12:55 AM
#1
Thread Starter
Junior Member
[RESOLVED] date selection using vb6 and msaccess
hi,
im having a problem in getting the sales based on a date range given by a user.. pls help me provide the code.. tnx
-
Feb 12th, 2007, 02:58 AM
#2
Re: date selection using vb6 and msaccess
The Query should similar to this:
SELECT YourDateField.YourTable FROM YourTable WHERE
YourDateField.YourTable > #10/10/2006# AND YourDateField.YourTable < #1/2/2007#;
Note1: the date notation is in US style -> Month,Day,Year
Note2: A date should be surrounded by # in a SQL query to be regognized as such
Note3: The code to extract this query from your Access database depends on the type of connection you want to make DOA, ADO and if you want to use a datacontrol or not to bind a form/controle to this data.
 why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
for every question you ask provide an answer on another thread.
-
Feb 16th, 2007, 05:28 AM
#3
Frenzied Member
Re: date selection using vb6 and msaccess
Additionally would it not be safer to use BETWEEN instead of > or <. Further are we not to use
format("10/10/2006",desiredformat)
to ensure safer working with databases.
correct me if I am wrong.
"SELECT * FROM ORDERS WHERE orderDate BETWEEN #" & format("10/10/2006","yyyy/mm/dd") & "# AND #" & format("1/2/2007","yyyy/mm/dd") & "#"
-
Feb 16th, 2007, 07:37 AM
#4
Thread Starter
Junior Member
Re: date selection using vb6 and msaccess
thanks pips..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|