PC Review


Reply
Thread Tools Rate Thread

Query parameters for search

 
 
Igor via AccessMonster.com
Guest
Posts: n/a
 
      24th May 2006
Hi all out there..

Am I on the right track? I have set up a query to search my records. I want
to search by 6 fields which are inputted from a Form. I am using

Like [Forms]![frmMembers]![combobox] & "*" or Is Null

as the criteria where combobox are the parameters entered on the form. Im
getting all of my records returned with any search, is this because when a
combobox is empty, it adds every record?

What I want, is:
1 The query uses the comboboxes for the search parameters
2 If all comboboxes are empty, all records are returned.
3 If a combobox is filled in, but another is empty, the search only uses the
filled in combobox.

Any suggestions?

Thanks all...

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200605/1
 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      24th May 2006
Try it like this:

Like Nz([Forms]![frmMembers]![combobox], "*")

It uses the Nz function to replace the value of the combo box with * if the
combo box is null; otherwise, it uses the value in the combo.

"Igor via AccessMonster.com" wrote:

> Hi all out there..
>
> Am I on the right track? I have set up a query to search my records. I want
> to search by 6 fields which are inputted from a Form. I am using
>
> Like [Forms]![frmMembers]![combobox] & "*" or Is Null
>
> as the criteria where combobox are the parameters entered on the form. Im
> getting all of my records returned with any search, is this because when a
> combobox is empty, it adds every record?
>
> What I want, is:
> 1 The query uses the comboboxes for the search parameters
> 2 If all comboboxes are empty, all records are returned.
> 3 If a combobox is filled in, but another is empty, the search only uses the
> filled in combobox.
>
> Any suggestions?
>
> Thanks all...
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...eries/200605/1
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set sub (embedded?) query parameters using VBA, call sub query in primary query with parameters completed Kelii Microsoft Access 4 5th Feb 2007 04:01 AM
Passing output parameters to SQL Server stored procedures through an SqlCommand object's Parameters collection Mark Rae Microsoft ADO .NET 8 26th Sep 2005 03:28 PM
Proposal: Default Parameters/Named Parameters cody Microsoft C# .NET 8 14th Feb 2005 05:01 PM
Event Log Replacement Parameters and WriteEntry() - Are replacement parameters deprecated? Mike Microsoft Dot NET Framework 1 21st Oct 2004 10:50 PM
Why is 2098 the maximum number of parameters in SqlCommand.Parameters Paul Clark Microsoft ADO .NET 3 24th Aug 2003 06:43 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:01 AM.