Adding a date to a DAO table

I am adding records to a MS Access table with VC 6.0. I am able to set all my fields except a date field. I have tried adding the record as a string

m_pSet->DateField = "01/27/99";

I have also tried to insert it as a CTime object in various format but It will now allow me.

Am I missing a simple concept here?
Thanks
lgalmaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
V_BapatConnect With a Mentor Commented:
Try this :

m_pSet->DateField.SetDate(99, 1, 27);

Vicky
0
 
lgalmaAuthor Commented:
I forgot to mention that I also tried placing # on the outside of the string.

thanks...
0
 
V_BapatCommented:
DateField is an object of COleDateTime. Use members of COleDateTime to manipulate DateField.

You can set the input mask of the DateField field in the access table to suit your need. In that case you may have to use other functions like SetDateTime() etc instead of SetDate() depending on your input mask.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
lgalmaAuthor Commented:
AHHHHHH!!! That makes sence. Thank you...  Does that go for ODBC also?
0
 
V_BapatCommented:
It should work as long as DateField is an object of COleDateTime. You just have to check the type in Member Variable tab of class wizard. If it is COleDataTime, use these member functions. If it is some other type, find the member functions for that class.
0
 
lgalmaAuthor Commented:
It's coming together. Thanks...
0
All Courses

From novice to tech pro — start learning today.