Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Report from a dialog form, using ALL from a COMBO Box

Report from a dialog form, using ALL from a COMBO Box

Report from a dialog form, using ALL from a COMBO Box

In Access 97, I have a report that prints based on the field selected from a combo box form.  The report uses a query as the recordsource, where the field Criteria in the query =forms!frmForm1!cmbfield1 .  This works great, but I'm trying to get the combo box to offer up "(All)" and then use that value in my query.   I used the example by Dev Ashish, but am still having trouble getting this to work.

Can someone help?

RE: Report from a dialog form, using ALL from a COMBO Box

Are you having trouble getting the (All) into your combo box? or getting the query to respond to a selection of (All)?

If it is the latter, you can type this in the criteria field:
iif((forms!frmForm1!cmbfield1 = "(All)"), "Like '*'", forms!frmForm1!cmbfield1)

If the combo box is the result of a query, to get (All) in the list, you may have to go with a value list and build the row source via a recordset, where you add your (All) to the list.  Make sense?  I can provide some additional assistance with this if you need.


RE: Report from a dialog form, using ALL from a COMBO Box

Thanks for the reply, Chopper.  The problem is the latter;  getting the query to respond to a selection of (All).  I tried the iif((forms!frmForm1!cmbfield1 = "(All)"), "Like '*'", forms!frmForm1!cmbfield1).  There is something that it doesn't like about the Like syntax, as the query returns no records.  Maybe there's something wrong with the " or ' placement.  I looked in HELP (tee hee!)  Let me know if there is a syntax problem.

Thanks, Chopper!

RE: Report from a dialog form, using ALL from a COMBO Box

I'm not sure this code's source, but I've used it successfully, and it accomplishes the basics of what you are looking to do.

I'm currently ripping through my archives trying to find a very cool piece of code for a union query which can be used to add an '(All)' selection to the combo box, but have yet to find where I might have hidden it, or figure out how to replicate it.

In your query in the criteria line under the field you want to test, write:

Like IIf(Len([Forms]![Your Form Name]![Your TextBox Name])>0,[Forms]![Your Form Name]![Your TextBox Name],"*")

If the textbox on your form is empty, this field will not be limited but if the textbox on your form is filled in, it will be used to limit the query to matching entries in the table.

HTH (and thank you to the original poster of this code fragment),


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close