Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2005
    Posts
    61

    Unanswered: Problem with update statement please help.

    I'm trying to update a field that is set to text.
    The variable FixedSSN is set to say "099999999"
    The problem is that it is dropping the 0 at the beginning, and setting the field to the value of "99999999" How can I fix this? I want the 0 at the beginning. Here is a copy of the string that I am using.

    DoCmd.RunSQL "UPDATE MemberInformation SET MemberInformation." & FieldName & " = " & FixedSSN & " WHERE (((MemberInformation.[ID])= " & lngRecordNumber & "))"

    Thanks for the help.

    Mythos

  2. #2
    Join Date
    Jun 2006
    Location
    Centeral Florida
    Posts
    5
    Question. Is the vaiable FixedSSN also text?

  3. #3
    Join Date
    Apr 2005
    Posts
    61

    Sorry for delayed response

    FixedSSN is a string variable. in debug mode the update string shows a value of 09999999 for FixedSSN so it's there but not being carried into the field itself which is set to text on the table.

    Thank you for your help.

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Text needs to be enclosed in quotes if want to update with a literal string. Otherwise access assumes you are passing in a number. Numbers don't have leading zeros:

    FieldName & " = '" & FixedSSN & "' WHERE
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    Apr 2005
    Posts
    61

    Thank you

    Thanks for the help as always this is the place to find the answers you are needing. It truely is appreciated.

Posting Permissions

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