|
-
Aug 24th, 2009, 03:22 AM
#1
Thread Starter
Addicted Member
SQL command and vb6
In my access file I write code in query
Code:
SELECT AccountInfo.incategory, Sum(AccountInfo.InAmount) AS TotalAmount
FROM AccountInfo
WHERE (((AccountInfo.Date)>=#1/1/2009# And (AccountInfo.Date)<=#12/31/2009#))
GROUP BY AccountInfo.incategory;
It show the total amount between 01-01-09 to 31-12-09 and it show in report. but in vb6 I want I select this two date and the total amount will show in report. what I need to do?
-
Aug 24th, 2009, 03:33 AM
#2
Frenzied Member
Re: SQL command and vb6
where date = thisdate or date = thatdate
Good Luck
Option Explicit should not be an Option!
-
Aug 24th, 2009, 04:10 AM
#3
Thread Starter
Addicted Member
Re: SQL command and vb6
another thing in this query date is not show. cause if I show the date then it not work. if I use your code in vb6 then how it find out the amount and category by date. cause date not show. please details.
-
Aug 24th, 2009, 05:40 AM
#4
Re: SQL command and vb6
Thread moved to 'Database Development' forum (the 'VB6' forum is only meant for questions which don't fit in more specific forums)
I think you should be the one to give more details - because I don't actually know what you are trying to do, or which part(s) of it you are having a problem with.
-
Aug 24th, 2009, 08:29 PM
#5
Thread Starter
Addicted Member
Re: SQL command and vb6
I made a query in access. here three field. Incategory, INamount, date. and I write code what I write above. here I write date. so the data show between this date. I want I select this date from vb6 not from access and the data show in vb6.
-
Aug 24th, 2009, 09:37 PM
#6
Thread Starter
Addicted Member
Re: SQL command and vb6
I write in data environment:
Code:
SELECT AccountInfo.incategory, Sum(AccountInfo.InAmount) AS SumOfInAmount FROM AccountInfo where Date and Date between DTFr.value and DTTo.vlaue GROUP BY AccountInfo.incategory;
DTFr and DTTo is dtpicker. and I write code in a button for show the report is
Code:
Load DataEnvironment1
With DataEnvironment1
If .Command3.State <> 0 Then .Command3.Close
.Command3 Format(DTFr.Value, "dd/mm/yyyy"), Format(DTTo.Value, "dd/mm/yyyy")
End With
datareport1.Show
but a error msg show:
"compile error:
argument not optional"
and then select this word
Code:
If .Command3.State <> 0 Then .Command3.Close
now what I need to do?
-
Aug 25th, 2009, 04:00 AM
#7
Re: SQL command and vb6
I think you're saying that you want a user to be able to select their own dates, rather than hard coding them into your sql string, is that right?
If so you just need to put a pair of datepickers onto a form and use their values as parameters when issuing your sql statement. The ADO tutorials at the top of the forum will show you exactly how to do this.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
Aug 29th, 2009, 08:59 PM
#8
Thread Starter
Addicted Member
Re: SQL command and vb6
why show this msg:
"compile error:
argument not optional"
-
Aug 30th, 2009, 10:27 AM
#9
Re: SQL command and vb6
That is one of the errors covered by the article What does this error mean, and how do I fix it? from our Classic VB FAQs (in the FAQ forum)
If you want more help than that, you'll need to give us more details - such as which line the error occurred on, etc.
Tags for this Thread
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
|