Click to See Complete Forum and Search --> : data type conversion error when moving a date from a label to a database
Leeper77
Jan 27th, 2000, 07:29 PM
I am getting a data conversion error when i am moving a date from a label to a new db when the field is a date format do you guys have any ideas? thanks
netSurfer
Jan 27th, 2000, 08:08 PM
WHat is the code you're using to convert the label to the database?
Leeper77
Jan 27th, 2000, 08:50 PM
all im doing is this
Data1.Recordset![Retirement Date] = lblRetire.Caption
and im sure there is soimething else i should do but im not sure
netSurfer
Jan 27th, 2000, 09:07 PM
You need to convert the label from a string to a date using CDate(lblLabel.caption)
You should probably use the format(lbllable.caption, "MM/DD/YYYY")
to format the label into the correct date format. So for example:
Data1.Recordset![Retirement Date] = format(cdate(lblRetire.Caption), "DD/MM/YYYY")
This would format the label's caption to a format of day/month/year.
Hope this helps.
JHausmann
Jan 28th, 2000, 12:45 AM
Maybe you can try:
Data1.Recordset![Retirement Date] = "#" & lblRetire.Caption & "#"
Leeper77
Jan 28th, 2000, 12:48 AM
both of those did work... I have one more question how do you clear out a text box? the cls doesnt work do you have any ideas?
netSurfer
Jan 28th, 2000, 12:52 AM
txtTextBox.text = "" :-)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.