wild cards & functions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If this question has been asked before please accept my apoligy. anyway on
the form is an unbound text box - txtTowtag and a list box the text box
allows the user to enter an value and is the passed via the afterupdate event
to a public function - Tagnum() which is placed in the criteria of the query
that populates the list box.
All works great however the user must type the exact value in the text box
for this to work. How can I fix it so wild cards could be used ie.. * 95
would then return all of the records that start with 95. Thanks as allways
for all of your help.
Cliff
 
It is possible in a query to use the * as a wild card if you make the criteria:
Like "95*"
That will include all rows where the field value begins with 95.
This will take a combination of user training and a charhe to you code. To
use a wild card search, the user will have to enter 95*. To find an exact
match he will have to eneter 95. In the query criteria, use LIKE &
Me.MyTextBox. If they enter 95, it will only return rows where the value is
95. If they enter 95*, it will return all rows that begin with 95.
 
Thanks for the input, here is what I did : removed the function gName() from
the criteria in the query and replaced it with - LIKE &
forms!frmMain!frmLocate.txtLname -
saved everything and opened up the form tried entering a varity of
combinations in the text box and got no returns.
Ideas???
 
What did the function gName() do? Perhaps it needs to be changed to make
this work. Post the code for gName() so we can have a look at it.
 
on the form are 4 unbound text boxes and and a list box. In the afterupdate
event of the four text boxes are the functions these functions are public and
are then placed in the criteria of the query under each of the field. The
query then populates the list box

Public Functiion Tow()
Tow = forms!frmMain!frmLocate!txtTowTag
End Function

Public Functiion GetDate()
GetDate = forms!frmMain!frmLocate!txtGetDate
End Function

Public Functiion Color()
Color = forms!frmMain!frmLocate!txtcolor
End Function

Public Functiion Make()
Make = forms!frmMain!frmLocate!txtMake
End Function

When the user enters a color of say "blue" in the text box and hits return
the query returns all of the records that have are equal to "blue" and then
populates the list box where the user may then select then record of choice.

what I want to do is provide the ability for the user to enter in the text
box "bl*" and have the query return all of the records relating to that field
that begin with "bl"
much like the find ability that is on the tool bar
 
Am I to assume your query criteria is something like

=Tow()

If so, change it to
Like Tow()

Then change your function to:
Public Functiion Tow()
Tow = forms!frmMain!frmLocate!txtTowTag & "*"
End Function

Be aware I have not tested this, it is only a concept. Hopefully it will
work for you, please let me know.
 
Wow so far this part works well, now I need to clear the list box after each
search as the list box now accumlates with each search. The current coding
for the list box is for each of the text boxes in the after update event the
following code is lstFind1.requery and the source for lstFind1 is the query
we have been working on


Thanks so much for your help

Cliff
 
The easiest way to do this is:
With Me
.lstFind1.RowSource = ""
.RowSourece = ???
End With
??? = whatever the row source is.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top