Building SQL for Numeric Value in Text Field

Discussion in 'MCSD' started by =?Utf-8?B?U29mdFNwb3Q=?=, Sep 18, 2004.

  1. I have a Text field inside MSAccess that may contain either numeric, or
    alphanumeric values. Am trying to create an SQL statement to search on that
    field, however sometimes the criteria provided will be numeric, sometimes
    not. Tried using the following statement: (spaces exaggerate for clarity)

    strWhere = strWhere & strFldName & "= ' " & CStr(vTextA) & " ' "

    However an error is raised if vTextA is Numeric. Then I set up
     
    =?Utf-8?B?U29mdFNwb3Q=?=, Sep 18, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?U29mdFNwb3Q=?=

    Guest Guest

    What is the error and is the error occurring on this specific line? CStr()
    should convert any alpha-numeric value to a string, including empty text
    values. One thing that can trip it up is Null values. Perhaps the issue is
    coverting null values to a string. Look into the IsNull() function.
    http://support.microsoft.com/default.aspx?scid=kb;en-us;221343

    WKidd

    "SoftSpot" <> wrote in message
    news:...
    > I have a Text field inside MSAccess that may contain either numeric, or
    > alphanumeric values. Am trying to create an SQL statement to search on

    that
    > field, however sometimes the criteria provided will be numeric, sometimes
    > not. Tried using the following statement: (spaces exaggerate for clarity)
    >
    > strWhere = strWhere & strFldName & "= ' " & CStr(vTextA) & " ' "
    >
    > However an error is raised if vTextA is Numeric. Then I set up
    >
     
    Guest, Sep 18, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patriot

    Building to Building wireless

    Patriot, Nov 4, 2003, in forum: Cisco
    Replies:
    2
    Views:
    569
    Walter Roberson
    Nov 4, 2003
  2. algoral_2000
    Replies:
    0
    Views:
    445
    algoral_2000
    Apr 1, 2005
  3. Tim Jacob

    Wireless building-to-building 101

    Tim Jacob, Feb 15, 2006, in forum: Wireless Networking
    Replies:
    2
    Views:
    621
    =?Utf-8?B?dGFpcGFuNTQx?=
    Feb 17, 2006
  4. Jim
    Replies:
    5
    Views:
    948
    Barb Bowman
    Oct 5, 2007
  5. Giuen
    Replies:
    0
    Views:
    1,236
    Giuen
    Sep 12, 2008
Loading...

Share This Page