Results 1 to 4 of 4
  1. #1
    riffology is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2015
    Location
    Colorado
    Posts
    1

    Using Cdbl in an update query when there is a field mismatch issue.

    Hi All,

    I'm sure this is simple for most people, but I can't seem to figure out how to correct a mismatch issue for an update query. I have two tables, both of which contain an account number. In one table the account number is in text format and the other table the account number is in number format (I can't change the format in one table and it would be a hassle to change the format in the other table due to a multitude of queries). I know I can use CDbl to correct the mismatch issue, but I'm not sure how to use it. Could someone help?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Maybe like:

    SELECT *, CDbl([fieldname]) AS ActNumFixed FROM tablename;
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    An account number is usually an integer value, so using CDbl isn't really what you need. Use Clng instead.

    In the update query you would use Clng(textvalue) to change it to numeric.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Or use Val() and the specific number type shouldn't matter.

    Be aware all of these number conversion functions will error on Null.

    I think fixing the data type is better solution. Suggest you try this on a copy of the db.

    Why are you using an UPDATE query? If the field type is text, what field are you updating with number?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Update Query Issue
    By Voodeux2014 in forum Queries
    Replies: 9
    Last Post: 02-18-2015, 12:01 PM
  2. Replies: 2
    Last Post: 11-19-2012, 03:23 AM
  3. Update query issue
    By dastr in forum Queries
    Replies: 1
    Last Post: 03-28-2012, 04:39 AM
  4. Update query issue
    By doomy304 in forum Queries
    Replies: 2
    Last Post: 06-25-2011, 02:31 PM
  5. Update Query Performance Issue
    By Amber_1977 in forum Queries
    Replies: 2
    Last Post: 12-07-2010, 08:36 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums