text box with default value to filter query?

romanticode

Registered User.
Local time
Tomorrow, 04:36
Joined
Oct 26, 2007
Messages
39
i have a text box & a button to filter query, on my text box i have default value. so far i never get my filter work on my query, my filter is combination of dafault value & user input.

for exam; text box dafault value is "AABB" then if user input "123456", then the query will be filtered by "AABB123456". If user doesn't input anything, query will not be filtered or cansidered as "blank" (allthough there's default value).

so far i user Iif fungtion on query.
how can i make this idea work? what code should i place on my query / form?

thanks
 
Try this:
Make 2 fields on th form.
First (name f1) put default value "AABB". Second (name f2) put default
value "*". In this (second) user need to put 123456, (or nothing).
In query criteria put

Like [Forms]![FormName]![f1] & [Forms]![FormName]![f2]
 
thanks
but if user not input anything, is default value "AABB" will be included on query?
 
In query criteria need to be Like "AABB*",
try and see.
 
ok, i'll explain more detail.

let's say phone number as an example. on phon number there's country-area-ponenumber.

on my form just use 2 field/text box, let's say country-area. so country as a default value, the user need enter the area. if user enter nothing on area, query will display all phone number on the country. but if user enter an area, query will display all phone number on the area the country. for examp. 66 as country, 789 as area, my data store on query as 66789.

i hope that easy to understand.

thnks
 
Look at "DemoDefaultVA2000.mdb" (attachment).
Look at Table1, Query1, open Form1 ant try.
Adapt it as you need.
 

Attachments

Users who are viewing this thread

Back
Top Bottom