![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Aug 2004
Posts: 6
Rep Power: 0
![]() |
:rock: hi ya' all,
been a vb programmer for 6 years now and i still use DAO, .net came and still using DAO ...not the topic anyway ...u see, this has been bugging me for years now. it's about the time and date manipulation using DAO...first is this:dim time1 as date
time1 = dtpTimeStart.value
with datSubjects.recordset
if .recordcount > 0 then
.findfirst "SubjectTimeStart like '" & time1 & "'"
if not .nomatch then
msgbox "Success, finally!!!"
end if
end if
end withthen this: dim date1 as date
date1 = dtpDate.value
with datEnrollment.recordset
if .recordcount > 0 then
.findfirst "DateofEnrollment like '" & date1 &"'"
if not .nomatch then
msgbox ""Headaches gone, after six long years..."
end if
end if
end withmy teacher, 6 years back told me about adding a #, but i don't know where...my mind was slippin' then but not now.... :oops: if you would ask how i remedied this prob for six years, well this is what i do: dim time1 as date
time1 = dtpTimeStart.value
with datSubjects.recordset
if .recordcount > 0
.movefirst
while .eof = false
if .fields("SubjectTimeStart") = time1 then
msgbox "remedy...remedy..remedy"
end if
wend
end if
end withand for the other one: dim date1 as date
date1 = dtpDate.value
with datEnrollment.recordset
if .recordcount > 0
.movefirst
while .eof = false
if .fields("DateofEnrollment") = date1 then
msgbox "remedy...remedy..remedy"
end if
wend
end if
end withany help, ppl... :oops: :oops: :oops: |
|
|
|
|
|
#2 |
|
Expert Programmer
|
If the dates are stored in the databases as strings ("#DD/MM/YY hh:mm:ss") or seconds elapsed since 1/1/1970, the built in "cdate" function may help. Then you can let VB handle all the checking, without adding a "#" - it even seems to convert between timezones. Don't know much about DAO though - hope this helps.
|
|
|
|
|
|
#3 |
|
Newbie
Join Date: Aug 2004
Posts: 6
Rep Power: 0
![]() |
my remedy
sorry 'bout the delay and all, lots of work to do, not even a time to do a decent program anymore...(,")...anyway, what i did is just store it as a text in my database...afterwards, i made sure in the form load that my date picker is set in a specific time like
dtpdate1.value = #8:00 AM# and when i searched it using findfirst or run a sql query i could actually search or filter my records...thanks anyway from the tip, saw that one before in a sql query but never botheres to check if it would work... P.S. gosh, sorry guys...kinda lost it...forgot to do the "code" thing...it's been like months since i last visited... |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|