Results 1 to 3 of 3
  1. #1
    Join Date
    May 2006
    Posts
    8

    Unanswered: Alpha-numeric filter in ADO

    I have a problem getting non-numeric data from a filtered recordset.

    Iím running MS Access 2003, this is a front-end, back-end type application, and the entire connection is done with VBA and ADO.
    I am attempting to have people enter a serial number into the control txtConID on the form, and use that serial number to filter the recordset.

    My code is:
    Code:
    rsPortCard.Open ("tbl_PortCards"), conConnect, adOpenDynamic, adLockBatchOptimistic
    rsPortCard.Filter = "pcd_txtNumber=" & Me!txtConID
    with conConnect being the currently open connection to the data source.

    The code works fine and gives me all the correct records...so long as the serial number contains no letters. Numbers and symbols are fine, but the moment I try to put in a letter, I get the error message:

    ďArguments are of the wrong type, are out of acceptable range, or are in conflict with one another.Ē

    I have checked, and not only is the field set to text, I have alpha-numeric data in most of the records, so I know itís not that Iím trying to look at letters in a numeric field.

    I've been bashing my brain out over this one for a week now. It seems like such a little error, but it's messing up my entire search feature.

    Any thoughts?

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    rsPortCard.Filter = "pcd_txtNumber LIKE '" & Me!txtConID & "'"
    oh yeah... documentation... I have heard of that.

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

  3. #3
    Join Date
    May 2006
    Posts
    8
    Thank you so much. I'd tried the "LIKE" part of things, but I kept missing the single quote in it. It works perfectly now. Thank you so, so very much.

Posting Permissions

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