Results 1 to 2 of 2
  1. #1
    byterbit is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Location
    Noou Yauk
    Posts
    32

    Findfirst failing with a variable drawn from an autonumber field.

    Findfirst failing with a variable drawn from an autonumber field.



    That about says it; I grab a variable from the key field (an autonumber) and then turn it into a string ( Ive tried all the ways possible I think ) to find it against a text field.

    So , in the code I do

    vcard_fkey = Me!ID

    and then I try

    rs.FindFirst "fkey=" & vcard_fkey & "and type = 'card'"
    and it blows up with a “data type mismatch in criteria expression”

    I then try casting the variable into a string(no good), and then I declared it as a string(no good) and then I checked it was a string with
    MsgBox TypeName(vcard_fkey)
    And , indeed it was a string, and yes, fkey is a text field
    And it all worked the other way, when fkey was a number field, but I needed it as a text

    so let me add:

    Help !

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    If the field is text try this:

    rs.FindFirst "fkey='" & vcard_fkey & "' and type = 'card'"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Customizing the Autonumber field
    By wasim_sono in forum Access
    Replies: 3
    Last Post: 10-24-2014, 03:00 PM
  2. Using Dcount on an Autonumber Field
    By rfs in forum Forms
    Replies: 0
    Last Post: 03-17-2011, 10:04 AM
  3. Manually autonumber a field
    By apsf68 in forum Access
    Replies: 15
    Last Post: 11-13-2010, 04:04 PM
  4. Failing on my database miserably
    By jmathews004 in forum Access
    Replies: 6
    Last Post: 04-11-2010, 03:56 PM
  5. Autofill field based on autonumber field
    By frevilla in forum Forms
    Replies: 1
    Last Post: 09-11-2009, 02:50 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