WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

how to have access recognize data type? HELP

 
   Home -> Office other -> General Discussions RSS
Next:  first control getting focus when seaching thru re..  
Author Message
ges

External


Since: Jul 22, 2008
Posts: 4



(Msg. 1) Posted: Mon Oct 06, 2008 6:55 pm
Post subject: how to have access recognize data type? HELP
Archived from groups: microsoft>public>access (more info?)

I have a text box for search. I like to be able to search Account number
(number )or Customer Name (string)

When I click search button I like access to be able to get the sql statement:
For example :
If text box value is number than go to SQLA
if text box value is string than go to SQLB

Can anyone help me ?

Thanks in advance for any help....

Ges

--
Ges Khu
Geskhu.TakeThisOut@yahoo.com
Access Beginner

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access/200810/1
Back to top
Login to vote
Dirk Goldgar

External


Since: Oct 05, 2006
Posts: 529



(Msg. 2) Posted: Mon Oct 06, 2008 6:55 pm
Post subject: Re: how to have access recognize data type? HELP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"ges" <[email snipped]> wrote in message news:8b45c2daffde6@uwe...
>I have a text box for search. I like to be able to search Account number
> (number )or Customer Name (string)
>
> When I click search button I like access to be able to get the sql
> statement:
> For example :
> If text box value is number than go to SQLA
> if text box value is string than go to SQLB
>
> Can anyone help me ?
>
> Thanks in advance for any help....
>
> Ges
>
> --
> Ges Khu


(Note: I don't recommend posting your e-mail address in a public newsgroup.
It's a good way to get yourself buried in spam.)

You should be able to use code along these lines:

If IsNull(Me!txtSearchFor) Then
MsgBox "Enter something in the search box, please."
ElseIf Me!txtSearchFor Like "*[!0-9]*" Then
' It's text -- use SQL for string value ...
Else
' It's numeric -- use SQL for number value ...
End If


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
Back to top
Login to vote
Dirk Goldgar

External


Since: Oct 05, 2006
Posts: 529



(Msg. 3) Posted: Mon Oct 06, 2008 6:55 pm
Post subject: Re: how to have access recognize data type? HELP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"ges via AccessMonster.com" wrote in message news:8b465111cb8b1@uwe...
> Dirk,
> Thanks for the advice and the code, THANK YOU.
> If you don't mind I just have one more question:
>
> I like to have the text box value using LIKE "Psych%"
> WHERE (((tblAccounts.a_FileType)='Arden') AND ((tblAccounts.a_BillName)
> Like
> "Psych%"))
>
> How do I put it in text box?
>
> I try as follow but give me an error:
> WHERE tblAccounts.a-BillName LIKE " & """"% & textbox& """" & "


Do you want all searches of this type to use the wild-cards, so you're
looking for any record that contains the value in the text box? If so,
you're almost there, but you've got quoting problems. Try this

"WHERE tblAccounts.a-BillName LIKE ""%" & textbox & "%"""

I'm assuming you're building this SQL string in code, so we need to
double-up the quotes that go inside the SQL literal. Or you could avoid
that confusing notation by using Chr(34) instead:

"WHERE tblAccounts.a-BillName LIKE " & _
Chr(34) & "%" & textbox & "%" & Chr(34)

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
Back to top
Login to vote
Display posts from previous:   
       Home -> Office other -> General Discussions All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
 Office
  Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET