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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search by Form 1

Status
Not open for further replies.

pleg12345

IS-IT--Management
Dec 21, 2003
48
EU
Please can somebody help me..........
i have created a new forms containing a number of fields relating to a specific table.

These fields are being used as a search criteria.

I also have a command button which opens up a query, and takes the user inputted information from the form.

However if any of the fields are left blank the query returns with nothing. How do i solve this problem?
 
Set the default value of all text boxes to "*".

Cheers,
MakeItSo

Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Well, you haven't told us how you're accomplishing the search, so it's really hard to know what to tell you.

Do you know about the "filter by form" bit that's built into access. Open your form. Click on the icon of a funnel over a small form. Choose some criteria, in some fields. Click the funnel button. Voila.

Or, tell us how you're filtering and we'll be able to help you fix it up.

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Access Databases for Non-Profit Organizations

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
"*" did not work when i put it in the default value.


i have created a query which takes the data from the form and then looks in the table for the records that relate to this.

[Forms]![Form1]![test1]

but it does not allow a null value?
 
"*" did not work when i put it in the default value
Could you specify this?
Does that mean you have not received any results or have you received an error message? If yes: which?

If no: Any Date/Time-fields being queried?

Sure you refer to the correct control names of the form?
Do you get any requests for Paramater values?
 
it just produced no results. no error

it works when i add matching records to whats held in the table but thats it.

but if one field is left blank then it brings up no records!
 
Dear pleg12345,

The information that the others provided is good and correct, but there is one thing missing.(At least I think so)

Open up your query and go to where you specify the criteria parameters. When you specify a parameter or a value, the default search is equal ('='). So, add the key word 'LIKE' to the beginning of each criteria. That should do the trick.

Example:
Old: Criteria might look like this:
[Form].[frmEnterParamters].[CustomerName]

New: Criteria Should look like this:
Like [Form].[frmEnterParamters].[CustomerName]

Make this change to each criteria field used.
Hope this helps,

Hap [2thumbsup]


Access Developer [pc] Access based Add-on Solutions
Access Consultants forum
 
that didnt work either, cheers for trying though!
 
sorted it thanks!!!!!!!!

i missed off a & after "*"

Thanks again
 
Dear pleg12345,

Well, then I would guess that there is something wrong with your query.

I would suggest that you make a copy of your live query and then try narrowing down your problem.

1) In the test query, start with just one field, best a text field.
2) Type your 'Criteria' as a true 'Hardcoded' criteria to make sure it works and pulls data.
3) Now use the form to pass the one value only. Remeber that the form must be open for the query to actually read the value.

Now, when you get one value to work, add it does, then add a second passed parameter.

Note: Remeber, if you pass 2 or more variables, then the selection must pass all parameters, because the default selection logic is 'and' logic
So If you pass Customer Name as Like 'Smit* and a second parameter such as State as Like 'PA' then only customers whose name begins with 'Smit' and are in 'PA' will be returned.

Hap

Access Developer [pc] Access based Add-on Solutions
Access Consultants forum
 
Yepp, I missed this one. Good eye, Hap! [thumbsup2]

P.S: XCLNt website you have!
-16.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top