Paramter Query for Null Value (Leo)

G

Guest

Hi,
How I can make parameter query which asks user for either Null or not Null
values (only two options) and then assign this parameter to a control on a
form as dialog for inquiry, to run the form or report afterward??
Lets give you more details;
I have a form which its main form is only to aks user for any Account # and
based on that Account # , the subform is filtered by assigning the Combo box
value to it underlying query parameter [Parameter Account] =
Forms![MyForms].ComboAccount.
Now I need also aks user if he/she wants to look in to only Transactions
with Voucher No. or All Transactions (with or Without Voucher No) by putting
a parameter in that unerlying query (a query that runs for subform) and
assigning it to a control (such as option button) to choose between Null or
not Null values.
How Can it be done?! please help!
 
G

Guest

I your form add another text box where the user can input the Account Number,
and then add that filter to your query

If you have now
Select * From TableName Where [Parameter Account] =
Forms![MyForms].ComboAccount

Then the new query will look like:

Select * From TableName Where [Parameter Account] =
Forms![MyForms].ComboAccount
And ([VoucherFieldName] = Forms![MyForm].[TextBoxName] Or
Forms![MyForm].[TextBoxName] Is Null)

That way if the user will input an account number in the text box, the query
will be filtered by it, if no account number was input, then all records will
return
I rather using a text box, that way the user wont have to type the account
number every time, if there is a typing mistake

To use a parameter in the query instead of a text box in the form, its quite
a simillar method

Select * From TableName Where [Parameter Account] =
Forms![MyForms].ComboAccount
And ([VoucherFieldName] = [Please select Voucher] Or[Please select Voucher]
Is Null)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top