Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

txtSearchString display table condition 1

Status
Not open for further replies.

thefroggy

Technical User
Apr 20, 2004
31
GB
Hi,

I'm trying to run an SLQ with two conditions in a table form.

The first condition is a normal txtSearchString application, but I would like to only display some of the d
ata. the (simplified) code I'm currently using is the following:

txtSearchString = Me!TxtX.Text

strSQL = "SELECT DISTINCT tlb.ID as ID, tlb.Code as Code FROM tlb "
strSQL = strSQL & "WHERE ((tlb.ID) Like '" & txtSearchString & "*') "
strSQL = strSQL & "ORDER BY lb.ID"


The problem I have is that not all my data have a Code in tbl, I just want to display value selected with the txtSearchString which have a code in tbl.

Can you help me please, hope this is clear enough.

thanks,

Steph

 
strSQL = "SELECT DISTINCT tlb.ID, tlb.Code FROM tlb "
strSQL = strSQL & "WHERE tlb.ID Like '" & txtSearchString & "*' "
strSQL = strSQL & "AND tlb.Code & '' > '' "
strSQL = strSQL & "ORDER BY tlb.ID"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks exactly what I was trying to do.

steph
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top