Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397

    Unanswered: Code to search data with (-) sign

    Hi,
    A text data type field contains following kind of data and I am trying to create a search combo (CboSearchItem) based on this data.

    854-5624
    4587-524
    36-524
    8924-5212

    In another combo box I used following trick to get the text type data that was containing single (‘) or double (“) quotation mark in the product name and it worked fine.

    Set rst1 = CurrentDb.OpenRecordset("Select * From Product_Master " & _
    "where Productname= '" & Replace(CboProduct, Chr(39), Chr(34) & Chr(34)) & "'")


    The above same code I am trying over the new combo (CboSearchItem) to search data replacing Chr(39) with Chr(45) which is for (-) minus ASCII character set but it is not returning the data.

    Any idea how could I come over this situation?

    With kind regards,
    Ashfaque

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    do you imagine that we don't notice you cross-posting on other forums?
    don't hold your breath for a reply here (from me, at least).

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    izyrider's pint is well taken; cross-posting has the possibilty of wasting people's time! Since I apparently don't visit the other forum I'll answer here. I'm confused about your need to use code to accomplish your task here.

    A text data type field contains following kind of data and I am trying to create a search combo (CboSearchItem) based on this data.

    854-5624
    4587-524
    36-524
    8924-5212
    So place a combo box on your form, and when the Combo box Wizard pops up, follow the directions!

    Select "Find a record based on the value I selected in my combobox."
    Hit Next.
    Click on the field you're searching by to move it to the right side.
    Hit Next.
    Size the column appropriately.
    Hit Next.
    Name the combobox.
    Hit Finish.

    This will retrieve your record, based on your selected field, whether that field has quotation marks or minus signs, or whatever! Why make things complicated?
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Izy,

    Cross posting is not in the same forum. I raised this thread in other forum due to the urgency of matter. So which ever comes earlier, off course the user will pick up. Anyhow. I did not intent to waste your valuable time you contributing to the people. Thanks for that.

    And thanks Missingling for your advice. I will try your trick.

    With kind regards,
    Ashfaque

Posting Permissions

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