How? Linking a select all box to a query field criteria line

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am working on a database where I have a form that a user can either use
combox box range or select the check box to "select all". From the form, I
am linking the combo box range to the criteria line of my query. The query
will pick up the selection range from the combo boxes if it doesn't have the
check box selected. However, if the check box is selected (which greys out
the combo boxes), the query won't pick up my parameter selection of select
all.

How do I get the query to run regardless of whether the user uses the combo
boxes or checks the check box to select all?

Help! Thank you.
 
I am not certain of exactly how you are coding this so I am just showing a
simple example.

Dim sSQL as String
Dim sWhere as String

sSQL = "SELECT * FROM MyTable "

If myCheckBox.Value = False Then
'Define sWhere Clause Here
sSQL = sSQL & sWhere
End If

'Execute sSQL Here

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Hi,

I am working on a database where I have a form that a user can either use
combox box range or select the check box to "select all". From the form, I
am linking the combo box range to the criteria line of my query. The query
will pick up the selection range from the combo boxes if it doesn't have
the
check box selected. However, if the check box is selected (which greys out
the combo boxes), the query won't pick up my parameter selection of select
all.

How do I get the query to run regardless of whether the user uses the combo
boxes or checks the check box to select all?

Help! Thank you.
 
Can you tell me how to do this using a select query?

Would an if/then statement work such as,

IIf((Between [Forms]![Frm_Idata]![Beg Inst ID] And [Forms]![Frm_Idata]![End
Inst ID]) Is Null, ????????? ,Between [Forms]![Frm_Idata]![Beg Inst ID]
And [Forms]![Frm_Idata]![End Inst ID])

I need help!

Thank you.
 
No, you can't use an Iif statement like that, nor is Between
[Forms]![Frm_Idata]![Beg Inst ID] And [Forms]![Frm_Idata]![End Inst ID]) Is
Null valid.

Assuming that checkbox is on your form, you could use something like the
following for your where clause:

WHERE (My Id Between [Forms]![Frm_Idata]![Beg Inst ID] And
[Forms]![Frm_Idata]![End Inst ID])
OR ([Forms]![Frm_Idata]![MyCheckBox] = True)
--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Terri said:
Can you tell me how to do this using a select query?

Would an if/then statement work such as,

IIf((Between [Forms]![Frm_Idata]![Beg Inst ID] And
[Forms]![Frm_Idata]![End
Inst ID]) Is Null, ????????? ,Between [Forms]![Frm_Idata]![Beg Inst
ID]
And [Forms]![Frm_Idata]![End Inst ID])

I need help!

Thank you.





--
Terri


David Lloyd said:
I am not certain of exactly how you are coding this so I am just showing
a
simple example.

Dim sSQL as String
Dim sWhere as String

sSQL = "SELECT * FROM MyTable "

If myCheckBox.Value = False Then
'Define sWhere Clause Here
sSQL = sSQL & sWhere
End If

'Execute sSQL Here

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or
warranties.


Hi,

I am working on a database where I have a form that a user can either use
combox box range or select the check box to "select all". From the form,
I
am linking the combo box range to the criteria line of my query. The
query
will pick up the selection range from the combo boxes if it doesn't have
the
check box selected. However, if the check box is selected (which greys
out
the combo boxes), the query won't pick up my parameter selection of
select
all.

How do I get the query to run regardless of whether the user uses the
combo
boxes or checks the check box to select all?

Help! Thank you.
 
Hi,

I am working on a database where I have a form that a user can either use
combox box range or select the check box to "select all". From the form, I
am linking the combo box range to the criteria line of my query. The query
will pick up the selection range from the combo boxes if it doesn't have the
check box selected. However, if the check box is selected (which greys out
the combo boxes), the query won't pick up my parameter selection of select
all.

How do I get the query to run regardless of whether the user uses the combo
boxes or checks the check box to select all?

Use a criterion of

[Forms]![yourform]![yourcheckbox] = True

on a separate OR line from any of the other criteria.

John W. Vinson[MVP]
 
Back
Top