|
-
Dec 15th, 2009, 09:04 AM
#1
Thread Starter
New Member
[RESOLVED] Data Environment Query Problem
I've been trying to make this code work but all efforts failed
this is my code
Dim date1 As Date << also tried to make this as string but neither work
Dim date2 As Date << this also
date1 = Calendar1.Year & "/" & MonthName(Calendar1.Month) & "/" & Calendar1.Day
date2 = Calendar2.Year & "/" & MonthName(Calendar2.Month) & "/" & Calendar2.Day
one problem i know is the querying of date(bold text), when i try to remove it, the code works, but when it's there it won't work, and why is that?, i've tried a fixed query in the data environment command and it works, but i need a run time query not a fixed query
With DE1
If .rsCommand1.State = 1 Then .rsCommand1.Close
.Commands("Command1").CommandType = adCmdText
.Commands("Command1").CommandText = "SELECT [date],[time_start],[time_end],[total_time] FROM [computer_usage] WHERE ([date] BETWEEN " & date1 & " AND " & date2 & ") AND ([comp_name] = '" & Text1.Text & "') ORDER BY [date] DESC"
.Commands("Command1").Execute
.rsCommand1.Open
DataReport1.Show
End With
please somebody help me, i really really need this code to work
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
|