hello anybody know how can i make a search button??
im having a problem on the syntax or coding i need,

i mean, for example if i put a word on a textbox(txtUN), then i click on the cmdbutton(cmdSearch)
it will retrieve all info about the data that is been put on the textbox(txtUN)

and if example, i only put a single letter ,
example i put a letter "A"

it will display 1st all data on the database which starts on a letter "A"

(is this possible?)
thx for any1 who can help me,

Recommended Answers

All 4 Replies

you can make use of SQL, if you are using Database. Use "Like" clause
Ex :
select ename from emp where ename like 'A%'

Hi,

And if you are using access use "*" instead of "%" ex:
select ename from emp where ename like 'A*'

To build on what the previous two posters said, you basically want to use your textbox as a variable.

So in the on_click code of your command button put something like:

Form1.recordsource = "select * from tablename where columname like '" & textbox1.value & "*';"
form1.requery

This will change the underlying record source of your form based on the text in your text box.

You can actually get a nice filter going with several options via combo boxes and list boxes using this technique. I've got a working sample somewhere of about 6 options to filter a query based form somewhere.

Don't forget to check to make sure there is actually a value in the text box first.

wow thx for the help i got i fix with your help
thx to u 3:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.