Query by form (all), Default

kplatt

Registered User.
Local time
Today, 18:21
Joined
Aug 26, 2009
Messages
115
hi, i have a query by form with the condition below.

[Forms]![Intro]![Text3]

The drop down in the Intro form is for "Quarterly or Annual" but if the text box is not filled out i want the query to bring back all records for Quarterly and annual. Not just one or the other.

How can i do this without the program asking for the proper field. Thanks
 
[Forms]![Intro]![Text3] Or [Forms]![Intro]![Text3] Is Null
 
I knew it was easy, thanks
 
Hi

I had a similiar problem a few weeks ago and couldn't find an answer for this either.

This is not elegant but my work around was to create a duplicate query with the criteria field left blank. I then put code on the command button that runs the query like

Dim stDocName As String

if isnull(me.cboperiod) then
stDocName = "Query1"
DoCmd.OpenQuery stDocName, acNormal, acEdit
else
stDocName = "Query2"
DoCmd.OpenQuery stDocName, acNormal, acEdit
end if

It works but not the best. If you do get a better answer then please post as I'd be interested to know a better way.

Good luck.
 
Just seen vbaInet's answer. This is definately a better way.
 
Hi

I had a similiar problem a few weeks ago and couldn't find an answer for this either.

This is not elegant but my work around was to create a duplicate query with the criteria field left blank. I then put code on the command button that runs the query like

Dim stDocName As String

if isnull(me.cboperiod) then
stDocName = "Query1"
DoCmd.OpenQuery stDocName, acNormal, acEdit
else
stDocName = "Query2"
DoCmd.OpenQuery stDocName, acNormal, acEdit
end if

It works but not the best. If you do get a better answer then please post as I'd be interested to know a better way.

Good luck.
I bet now you would go back to your database and delete the redundant query ;)

@kplatt: No problemo!
 
I bet now you would go back to your database and delete the redundant query ;)

@kplatt: No problemo!

Nope. I'm taking the easy option, leave what's working alone. But will remember for future. Cheers
 

Users who are viewing this thread

Back
Top Bottom