Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Date field from VB6 into DBF table [sadeyes]

Status
Not open for further replies.

sane79

MIS
Nov 18, 2003
60
0
0
SG
Hi.. I need help with inserting date from vb6 to dbf table..

Currently, this is the code that I'm using... but I get error from VB.. can anyone advise me on this pls?
VB6 with foxpro dbf tables.

INSERT INTO TRANM (TRAN_DATE)
VALUES (" & Format$(dtTranDate, "{#yyyy\-mm\-dd}#") & ")
 
What is the error? Have you tried to format the date first and then do the insert?

Bastien

Any one have a techie job in Toronto, I need to work...being laid off sucks!
 

sane79 have you read FAQ222-2244 yet?

Are you using the ODBC driver? you may then want to pass the fox pro date function as part of your insert string with the values that you want.
[tt]
INSERT INTO TRANM (TRAN_DATE)
VALUES (date(" & Year(dtTranDate) & "," & Format(Month(dtTranDate), "00") & "," & Format(Day(dtTranDate), "00") & ")"
[/tt]

The fox pro date function has these parts

Date(Year, Month, Day)


Good Luck

 
Thanks all!
I managed to get it out with this...

sDateFormat = "\{MM\-DD\-YYYY}\"
insert into table (dtTranDate) values (" & Format$(dtTranDate, sDateFormat) & ")

(-:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top