PDA

Click to See Complete Forum and Search --> : DTpicker & ADO


allanbech
Nov 20th, 2000, 02:01 PM
Hi all,

I'm new in vb and trying to get into ADO and DTpicker.

I have some problems with dbgrid and the DTpicker. I would like to search on the date that DTpicker is showing!! But the dbgrid is empty.

Here is the code i'm trying, when I use the msgbox i can se the date that the Dtpicker is showing.

Please help me :-))

Private Sub Command2_Click()
Dim test As Date

test = DTPicker1.Value

'MsgBox "hello " & test

Adodc1.RecordSource = "SELECT * FROM Ugerapport WHERE Dato=" & test & ""
Adodc1.Refresh

End Sub

regards,
Allan Bech

Lafor
Nov 20th, 2000, 02:46 PM
Adodc1.RecordSource = "SELECT * FROM Ugerapport WHERE Dato=" & test & ""
Adodc1.Refresh


Try to put test in single quotes as follows


Adodc1.RecordSource = "SELECT * FROM Ugerapport WHERE Dato='" & test & "'"
Adodc1.Refresh


let us know

allanbech
Nov 20th, 2000, 02:58 PM
Hi Lafor

Thanks for your quick reply :-))

I found some MS Access information and now it works..

Here is the code that works

Adodc1.RecordSource = "SELECT * FROM Ugerapport WHERE Dato=#" & test & "#"
Adodc1.Refresh

I have tried with the quotes but it didn't work in my code!!

Anyway thanks again..

Regards
Allan