Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 29th, 2004, 7:28 AM   #1
mhykgyver
Newbie
 
Join Date: Aug 2004
Posts: 6
Rep Power: 0 mhykgyver is on a distinguished road
: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 with

then 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 with

my 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 with

and 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 with

any help, ppl... :oops: :oops: :oops:
mhykgyver is offline   Reply With Quote
Old Jan 18th, 2005, 4:22 AM   #2
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
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.
Rory is offline   Reply With Quote
Old Feb 16th, 2005, 7:48 PM   #3
mhykgyver
Newbie
 
Join Date: Aug 2004
Posts: 6
Rep Power: 0 mhykgyver is on a distinguished road
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...
mhykgyver is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:42 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC