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

Tech-Archive recommends: Fix windows errors by optimizing your registry



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
http://I.Am/DougSteele
(no e-mails, please!)



"Terri" <Terri@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:58361BB2-31DE-4F98-AF2D-EEED77DA9E17@xxxxxxxxxxxxxxxx
> 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" wrote:
>
>> 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.
>>
>>
>> "Terri" <Terri@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:AC7C7A34-DA98-40C0-A281-DECA298B884F@xxxxxxxxxxxxxxxx
>> 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.
>> --
>> Terri
>>
>>
>>


.



Relevant Pages

  • Re: VB-ADO-SQL Server : SQL Server performs logins after some queries
    ... If you have some joins or WHERE clause in your statement, ... Also try to minimize selection of the records using WHERE ... Incase of actual action query, ... >> of queries and I've concluded that in case of an internet conection the ...
    (microsoft.public.vb.database.ado)
  • Re: Using combo box selection to supply criteria for query
    ... Sorry, I am still learning SQL and VBA, I don't think that I made the ... The form contains 5 combo boxes; SBT Account, Region, ADM, Month, Year ... If I only make a selection in the Region combo box ... Post the query SQL. ...
    (microsoft.public.access.forms)
  • Re: Parameters
    ... I basically have four options in the combo box, can I add an All to that selection or maybe a check box? ... RowSourceType you can add "ALL" to the query by making it a Union query: ... ComboBox drop-down list. ... In the query that is based on the ComboBox the WHERE clause will look ...
    (microsoft.public.access.queries)
  • Re: Tying check boxes to data
    ... which you could then join to your basic query. ... INNER JOIN tblCheckBoxes ... I have a form with a combo box based on a table that when I make a selection ... but I've never worked with check boxes before. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Form like Query
    ... Thank you both for your help, I will look through these websites when I ... based on the selection in another. ... Look for cascading combo boxes. ... or several list boxes and have it query the ...
    (microsoft.public.access.forms)