A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

multiple input parameters on a form



 
 
Thread Tools Display Modes
  #1  
Old February 24th, 2007, 04:58 PM posted to microsoft.public.access.forms
magick
external usenet poster
 
Posts: 19
Default multiple input parameters on a form

i have 4 input parameters on a form, and want the user to be able to enter
none, any, or all. i am trying to then build a single query to use whatever
parameters they entered (or did not enter) instead of the separate queries in
a conditional macro as i have now.

i am using Access 2003
  #2  
Old February 25th, 2007, 10:34 AM posted to microsoft.public.access.forms
Allen Browne
external usenet poster
 
Posts: 11,706
Default multiple input parameters on a form

See:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html

The article explains how to build the filter string for a form (or
WhereCondition for OpenReport) based on only the boxes where the user
entered something.

The end of the article also explains how this can be done in queries without
code, but that approach is rather messy.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"magick" wrote in message
...
i have 4 input parameters on a form, and want the user to be able to enter
none, any, or all. i am trying to then build a single query to use
whatever
parameters they entered (or did not enter) instead of the separate queries
in
a conditional macro as i have now.

i am using Access 2003


  #3  
Old February 25th, 2007, 03:16 PM posted to microsoft.public.access.forms
magick
external usenet poster
 
Posts: 19
Default multiple input parameters on a form

gee, thanks! i had figured out the query option, but am anxious to try the
code. my application, however, uses an unbound form, and runs a query,
macro, or report depending on the selection a user chooses from a dropdown
box (after update). how would i produce the query results without attaching
it to a form's filter? thanks again.

"Allen Browne" wrote:

See:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html

The article explains how to build the filter string for a form (or
WhereCondition for OpenReport) based on only the boxes where the user
entered something.

The end of the article also explains how this can be done in queries without
code, but that approach is rather messy.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"magick" wrote in message
...
i have 4 input parameters on a form, and want the user to be able to enter
none, any, or all. i am trying to then build a single query to use
whatever
parameters they entered (or did not enter) instead of the separate queries
in
a conditional macro as i have now.

i am using Access 2003



  #4  
Old February 26th, 2007, 12:56 AM posted to microsoft.public.access.forms
Allen Browne
external usenet poster
 
Posts: 11,706
Default multiple input parameters on a form

Simplest solution would be to build a form (in Datasheet view if you want it
to look like a query) to display the results.

You could create the whole SQL statement, and then assign it to the SQL
property of the querydef, e.g.:
Const strcStub = "SELECT * FROM Customers WHERE "
Const strcTail = " ORDER BY CustomerName;"
Dim strWhere As String
'Build the string as suggested in the article
CurrentDb.QueryDefs("Query1").SQL = strcStub & strWhere & strcTail

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"magick" wrote in message
...
gee, thanks! i had figured out the query option, but am anxious to try
the
code. my application, however, uses an unbound form, and runs a query,
macro, or report depending on the selection a user chooses from a dropdown
box (after update). how would i produce the query results without
attaching
it to a form's filter? thanks again.

"Allen Browne" wrote:

See:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html

The article explains how to build the filter string for a form (or
WhereCondition for OpenReport) based on only the boxes where the user
entered something.

The end of the article also explains how this can be done in queries
without
code, but that approach is rather messy.

"magick" wrote in message
...
i have 4 input parameters on a form, and want the user to be able to
enter
none, any, or all. i am trying to then build a single query to use
whatever
parameters they entered (or did not enter) instead of the separate
queries
in
a conditional macro as i have now.

i am using Access 2003


  #5  
Old February 9th, 2010, 12:44 AM posted to microsoft.public.access.forms
Whitney
external usenet poster
 
Posts: 126
Default multiple input parameters on a form

I tried to use your SQL, but no luck.

I have a form with the following filters
Start Date
End Date
Issue
Agent
SLRep

I would like the user to be able to enter a minimum of 1 criteria to all
criteria.

How do I code the query as well?

"Allen Browne" wrote:

Simplest solution would be to build a form (in Datasheet view if you want it
to look like a query) to display the results.

You could create the whole SQL statement, and then assign it to the SQL
property of the querydef, e.g.:
Const strcStub = "SELECT * FROM Customers WHERE "
Const strcTail = " ORDER BY CustomerName;"
Dim strWhere As String
'Build the string as suggested in the article
CurrentDb.QueryDefs("Query1").SQL = strcStub & strWhere & strcTail

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"magick" wrote in message
...
gee, thanks! i had figured out the query option, but am anxious to try
the
code. my application, however, uses an unbound form, and runs a query,
macro, or report depending on the selection a user chooses from a dropdown
box (after update). how would i produce the query results without
attaching
it to a form's filter? thanks again.

"Allen Browne" wrote:

See:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html

The article explains how to build the filter string for a form (or
WhereCondition for OpenReport) based on only the boxes where the user
entered something.

The end of the article also explains how this can be done in queries
without
code, but that approach is rather messy.

"magick" wrote in message
...
i have 4 input parameters on a form, and want the user to be able to
enter
none, any, or all. i am trying to then build a single query to use
whatever
parameters they entered (or did not enter) instead of the separate
queries
in
a conditional macro as i have now.

i am using Access 2003



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.