using date in conditional statement

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2007
Posts: 47
Reputation: locsin is an unknown quantity at this point 
Solved Threads: 0
locsin locsin is offline Offline
Light Poster

using date in conditional statement

 
0
  #1
Apr 7th, 2009
Greetings!

i am using date in my program. My databasefield <draw_date> declared as shortdate in msaccess.

when i use in the programs

.Open "Select *From numgroup Where Draw_date = '" & DateValue(vdrawdate.Text) & "'", strconek, adOpenStatic, adLockOptimistic

I received error message.. Data Type mismatch in the criteria and sometimes Error 13

Anybody can help to use date as conditional statement..

thank you in advance
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 913
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 167
vb5prgrmr vb5prgrmr is offline Offline
Posting Shark

Re: using date in conditional statement

 
0
  #2
Apr 7th, 2009
With the single ticks ' surrounding your date, you are telling the database that you are passing a string. Try removing the single ticks or surrounding the date with # signs.

Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,149
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 132
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: using date in conditional statement

 
0
  #3
Apr 8th, 2009
you need to format the input to date for before passing the same to database for processing.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 428 | Replies: 2
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC