Results 1 to 7 of 7

Thread: data type conversion error when moving a date from a label to a database

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    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


  2. #2
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    WHat is the code you're using to convert the label to the database?

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    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

  4. #4
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    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.


  5. #5
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    Maybe you can try:

    Data1.Recordset![Retirement Date] = "#" & lblRetire.Caption & "#"

  6. #6

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    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?

  7. #7
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    txtTextBox.text = "" :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width