Results 1 to 6 of 6
  1. #1
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    Search string type mismatch have tried everything


    Hello!

    I have a combobox with 3 columns, ownername, lotnumber and loanid, to be used to choose a loan record. In the after update event I have
    Code:
    DoCmd.SearchForRecord , "", acFirst, "[fullName] = " & "'" & Combo134.Column(0) & "'" & _
    " and [lot_number] = " & "'" & Combo134.Column(1) & "'" And [LoanID] = (Combo134.Column(2)
    It works perfectly without the last criterion, [LoanID] = (Combo134.Column(2). I have tried various combinations of quotes, single quotes, no quotes. Etc. LoanID is a number. Name and lot number are text.

    I'm getting Runtime Error 13 - Type Mismatch. What am I missing Please? TIA!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Not correctly concatenating the LoanID field and combo and can simplify the concatenation. Extra paren in front of Combo134.

    DoCmd.SearchForRecord , "", acFirst, "[fullName] = '" & Combo134.Column(0) & _
    "' And [lot_number] = '" & Combo134.Column(1) & "' And [LoanID] =" & Combo134.Column(2)
    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
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Thank you June7 for trying, still getting Type Mismatch. Using:
    Code:
    DoCmd.SearchForRecord , "", acFirst, "[fullName] = " & "'" & Combo134.Column(0) & "'" & _
    " and [lot_number] = " & "'" & Combo134.Column(1) & "'" And [LoanID] = " & Combo134.Column(2)"

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    You are not concatenating. Why do you have quote mark at the end?

    DoCmd.SearchForRecord , "", acFirst, "[fullName] = " & "'" & Combo134.Column(0) & "'" & _
    " and [lot_number] = " & "'" & Combo134.Column(1) & "'" & " And [LoanID] = " & Combo134.Column(2)

    You could copy/paste my first suggestion.
    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
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Access put that last quote in there - I even erased it and it put it back. UGH. Anyway, I got it now.
    Code:
    DoCmd.SearchForRecord , "", acFirst, "[fullName] = " & "'" & Combo134.Column(0) & "'" & _
    " and [lot_number] = " & "'" & Combo134.Column(1) & "'" & " And [LoanID] = " & Combo134.Column(2)
    works beautifully. Thank you June7!

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Yes, Access was trying to be helpful because the quotes weren't balanced - must be in pairs.
    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. Type 13 (Type Mismatch) error
    By sdel_nevo in forum Programming
    Replies: 5
    Last Post: 01-22-2016, 10:01 AM
  2. Replies: 7
    Last Post: 12-26-2014, 12:17 PM
  3. Type mismatch from search field
    By gemadan96 in forum Programming
    Replies: 3
    Last Post: 01-09-2014, 09:29 AM
  4. type mismatch
    By slimjen in forum Forms
    Replies: 21
    Last Post: 07-24-2012, 03:14 PM
  5. Type Mismatch....WHY?!!?
    By jgelpi16 in forum Queries
    Replies: 9
    Last Post: 03-07-2011, 09:18 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