Results 1 to 8 of 8
  1. #1
    jasabel is offline Novice
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    10

    Relationship between two Tables. Field type mismatch. Integer and Text. ERROR

    I am querying a SQL Server and I need to configure a relationship between two tables BUT their fields are different in Type. Although both hold numbers, one of them is an integer an the other is stored in a text record.Obviously I get a type mismatch error.

    I suspect I have to convert the text to integer first I ignore the function.

    Thanks a lot

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Have you tried using a Query Object in Access to create the JOIN? Why are you mentioning a function, what function did you create/use?

    If you must create a 'Relationship', you will likely need a temp table on the client. Otherwise, I would expect Access to Cast the Integer or Cast the Text.

  3. #3
    jasabel is offline Novice
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    10
    Quote Originally Posted by ItsMe View Post
    Have you tried using a Query Object in Access to create the JOIN? Why are you mentioning a function, what function did you create/use?

    If you must create a 'Relationship', you will likely need a temp table on the client. Otherwise, I would expect Access to Cast the Integer or Cast the Text.
    Well, I have tried to make a intermediate query to change the text to a number using the function FormatNumber (field,0) and then link this query to the table with the integer field, but I get an mismatch error.

    I am using the query designer all the time, its easy to it in plain SQL and passtrough it but I want to avoid this option.

    regards

  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,967
    FormatNumber (as does Format) function still results in a text value. Try number conversion functions: Val(), CInt(), CDbl(). Issue with them is they will error if field is Null.
    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.

  5. #5
    jasabel is offline Novice
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    10
    I have found the solution here.... http://p2p.wrox.com/sql-language/121...rt-access.html

  6. #6
    jasabel is offline Novice
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    10
    Hey June7.
    You are right, I have sorted it using the Val function.
    Thanks a lot

  7. #7
    jasabel is offline Novice
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    10
    Ohhh no I have found another mismatch error using text fields. The thing is that I am linking tables in access from different databases

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You need to determine where your query is running. If you build a query that is not a pass-through query (no globe icon in the Navigation Pane) you can use functions intrinsic to Access. For instance, you can cast a Number type to Text type.
    https://msdn.microsoft.com/en-us/lib.../gg278896.aspx

    You seldom need to use theses functions because Access does a pretty good job managing implicit casting. However, when linking to other types of back ends, it is more important to be explicit with data types.

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

Similar Threads

  1. Error 13 Type Mismatch
    By jj1 in forum Access
    Replies: 5
    Last Post: 05-21-2014, 12:33 PM
  2. error 13 type mismatch
    By jkd in forum Programming
    Replies: 2
    Last Post: 04-19-2014, 09:46 PM
  3. Replies: 7
    Last Post: 07-24-2013, 02:01 PM
  4. type mismatch error 13
    By Compufreak in forum Access
    Replies: 3
    Last Post: 08-10-2012, 03:48 AM
  5. Replies: 1
    Last Post: 05-11-2012, 10:59 AM

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