Building SQL for Numeric Value in Text Field
 




IT Certification FAQ

 
|
Home
|
Microsoft
|
CISCO
|
CompTIA
|
Exam/Study FAQ
|
Employment FAQ
| Links  | Forums  |
Book Reviews


FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  ProfileProfile  Log in to check your private messagesPrivate messages  Log inLog in

Building SQL for Numeric Value in Text Field

 
Post new topic   Reply to topic    Forum Index -> microsoft.public.cert.exam.mcsd
Author Message
SoftSpot
Guest





PostPosted: Sat Sep 18, 2004 7:30 am    Post subject: Building SQL for Numeric Value in Text Field Reply with quote

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
Back to top
Guest






PostPosted: Sat Sep 18, 2004 4:30 pm    Post subject: Re: Building SQL for Numeric Value in Text Field Reply with quote

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" <SoftSpot@discussions.microsoft.com> wrote in message
news:AD82373B-E871-4A3F-A6EE-97C132A54CDE@microsoft.com...
Quote:
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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> microsoft.public.cert.exam.mcsd All times are GMT
Page 1 of 1

 

Copyright © 2002-2006 Web-S-Sense Pty. Ltd. All rights reserved.

Powered by phpBB
Advertising | Policies/Disclaimers | Contact us | Link to us


Featured Sites: Free Antivirus and Antispyware Info | Free PC Support | MCSE Directory