how to filter a form based on option buttons AND checkboxes at the same time

ih8code

Registered User.
Local time
Today, 23:09
Joined
Feb 19, 2014
Messages
15
Hi!

I created a form that has a button and 4 option buttons.I use the following code to export the data to an excel file:

Code:
Dim xlapp As Object
Set xlapp = CreateObject("excel.Application")
On Error Resume Next
If IsNull(Me.Frame22.Value) Then
MsgBox ("You must select a filter!"), vbOKOnly, "Export results"
DoCmd.CancelEvent
Exit Sub
ElseIf Not IsNull(Me.Frame22.Value) Then
Select Case Me.Frame22
  
  Case 1
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "byprinter", "c:\exp_reports\byprinter.xlsm", , "byprinter"
ShellEx "C:\exp_reports\byprinter.xlsm"
'Application.FollowHyperlink "C:\exp_reports\byprinter.xlsm"
xlapp.Quit
Set xlapp = Nothing
ShellEx "c:\users\****\desktop\flwme_reps\byprinter.xlsx"
'Application.FollowHyperlink "c:\users\****\desktop\flwme_reps\byprinter.xlsx"
and so on.

now i want to add some check boxes(companies) and combine the filters.I made a query for every possible combination so what i want is this:
if i check option 1 run this query.if i press option 1 AND checkbox1 run this query,and every other possible combination of option buttons and check boxes.Also i want,at least one check box,to be mandatory so if the user didn't click a check box then display a message saying something like "please choose a company".

Thanks
 
Your post is broad and you haven't asked a question. Where are you stuck?
 
Your post is broad and you haven't asked a question. Where are you stuck?

Hi.I just want the code for this

"if i check option 1 run this query.if i press option 1 AND checkbox1 run this query,and every other possible combination of option buttons and check boxes.Also i want,at least one check box,to be mandatory so if the user didn't click a check box then display a message saying something like "please choose a company""

Thank you
 
In my opinion the complexity of your problem exceeds the scope of a single thread. If you can narrow it down to a more specific problem, that would make it easier to provide useful assistance to you. For instance, do you know how to add the controls to the form? Can you tell us what the names of the controls are?
Hope this helps,
 
An option group would give you a "compulsory" selection as you term it.
 
Ah! I didn't understand your question, I see now that You want multiple check boxes selected.

This video shows how to keep one check box checked

https://youtu.be/7NJTtqCLhZc

The software I use for recording my screen casts "Screencast-O-Matic" (there's a free version) {URL:- https://screencast-o-matic.com/} has recently been upgraded with the ability to edit the audio track easily. I have done a couple of videos demonstrating this new feature. Because of this excellent new feature, I am going through my YouTube videos and when I find one which can be easily shortened, then I am shortening them... this was one.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom