Combobox "All" option code (1 Viewer)

JCColindres

Registered User.
Local time
Today, 07:49
Joined
Nov 29, 2019
Messages
15
Hi guys,

I have a question with comboboxes I have "combo7" with 3 option A B and C, I added an "All" option with UNION SELECT "<All>"

But now I'm stuck on how to process that "all" selection,
I got this so far

Private Sub YourCombobox_AfterUpdate()
If Me.Combo7= "<All>" Then


and Im stuck on the code to run the report with no criteria


Thanks
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:49
Joined
Oct 29, 2018
Messages
21,357
Re: Conditionally present a Drop down list

Hi guys,

I have a question with comboboxes I have "combo7" with 3 option A B and C, I added an "All" option with UNION SELECT "<All>"

But now I'm stuck on how to process that "all" selection,
I got this so far

Private Sub YourCombobox_AfterUpdate()
If Me.Combo7= "<All>" Then


and Im stuck on the code to run the report with no criteria


Thanks
How were you running the report before adding the all option?
 

JCColindres

Registered User.
Local time
Today, 07:49
Joined
Nov 29, 2019
Messages
15
Re: Conditionally present a Drop down list

By selecting one letter at the time
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:49
Joined
Oct 29, 2018
Messages
21,357
Re: Conditionally present a Drop down list

By selecting one letter at the time

No, I mean how exactly do you open the report. Or, how does selecting one letter works? Are you using any code? If so, can you show it to us?

PS. You might consider starting your own thread.
 

JCColindres

Registered User.
Local time
Today, 07:49
Joined
Nov 29, 2019
Messages
15
Re: Conditionally present a Drop down list

dates
Between [Forms]![Cases Report]![From] And [Forms]![Cases Report]![to]

Severity
[Forms]![Cases Report]![Combo7]

manager [Forms]![Cases Report]![Combo9]

Is this it?

Sorry I'm new at this
 

JCColindres

Registered User.
Local time
Today, 07:49
Joined
Nov 29, 2019
Messages
15
Re: Conditionally present a Drop down list

Ill scramble the names and upload it on Monday, it wll be a lot easier since I lack the vocabulary.

Thanks a lot and enjoy your weekend.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:49
Joined
Oct 29, 2018
Messages
21,357
Re: Conditionally present a Drop down list

dates
Between [Forms]![Cases Report]![From] And [Forms]![Cases Report]![to]

Severity
[Forms]![Cases Report]![Combo7]

manager [Forms]![Cases Report]![Combo9]

Is this it?

Sorry I'm new at this

Okay, assuming you were referring to Severity when said you wanted to select All, then try changing your criteria to something like.
Code:
(Forms![Cases Report].Combo7 Or Forms![Cases Report].Combo7 = "all")
 

isladogs

MVP / VIP
Local time
Today, 13:49
Joined
Jan 14, 2017
Messages
18,186
JCColindres
I moved these posts to a new thread as you had hijacked another thread question.
 

JCColindres

Registered User.
Local time
Today, 07:49
Joined
Nov 29, 2019
Messages
15
Re: Conditionally present a Drop down list

Okay, assuming you were referring to Severity when said you wanted to select All, then try changing your criteria to something like.
Code:
(Forms![Cases Report].Combo7 Or Forms![Cases Report].Combo7 = "all")

Thank you that did it, but it now I have another question sorry,

I added the same code to the managers combobox also and It works only when I select "all" on both comboxes

If I want to do a search for All severity for a single manager I'm getting a blank query, same if I want to run an all severities for a single manager,

Is there a way to make that work?

Here is the code I found where is it hehe

SELECT Cases.[SR Number], Cases.[Asigned Date], Cases.Agent, Cases.Type, Cases.Severity, Cases.Topic, Cases.Manager, Cases.S3
FROM Cases
WHERE (((Cases.[Asigned Date]) Between Forms![Cases Report]!From And Forms![Cases Report]!to) And ((Cases.Severity)=Forms![Cases Report]!Combo7) And ((Cases.Manager)=Forms![Cases Report]!Combo9)) Or ((Forms![Cases Report].Combo7="<All>") And (Forms![Cases Report].Combo9="<All>"));
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:49
Joined
Oct 29, 2018
Messages
21,357
Re: Conditionally present a Drop down list

Thank you that did it, but it now I have another question sorry,

I added the same code to the managers combobox also and It works only when I select "all" on both comboxes

If I want to do a search for All severity for a single manager I'm getting a blank query, same if I want to run an all severities for a single manager,

Is there a way to make that work?

Here is the code I found where is it hehe

SELECT Cases.[SR Number], Cases.[Asigned Date], Cases.Agent, Cases.Type, Cases.Severity, Cases.Topic, Cases.Manager, Cases.S3
FROM Cases
WHERE (((Cases.[Asigned Date]) Between Forms![Cases Report]!From And Forms![Cases Report]!to) And ((Cases.Severity)=Forms![Cases Report]!Combo7) And ((Cases.Manager)=Forms![Cases Report]!Combo9)) Or ((Forms![Cases Report].Combo7="<All>") And (Forms![Cases Report].Combo9="<All>"));
Hi. I would suggest you carefully study your parentheses placements because they mean "priority" when it comes to logic. Since you have a mixture of And and Or operators, the parens will dictate how the criteria is applied to the data set.
 

JCColindres

Registered User.
Local time
Today, 07:49
Joined
Nov 29, 2019
Messages
15
Re: Conditionally present a Drop down list

Hi. I would suggest you carefully study your parentheses placements because they mean "priority" when it comes to logic. Since you have a mixture of And and Or operators, the parens will dictate how the criteria is applied to the data set.

Hi,

I got it working, just added teh other 2 selection posibilities:

(((Cases.[Asigned Date]) Between [Forms]![Cases Report]![From] And [Forms]![Cases Report]![to])
AND
((Cases.Severity)=[Forms]![Cases Report]![Combo7])
AND
((Cases.Manager)=[Forms]![Cases Report]![Combo9]))
OR
((([Forms]![Cases Report].[Combo7])="<All>")
AND
(([Forms]![Cases Report].[Combo9])="<All>"))
OR
(((Cases.Manager)=[Forms]![Cases Report]![Combo9]) AND
(([Forms]![Cases Report].[Combo7])="<All>"))
OR
(((Cases.Severity)=[Forms]![Cases Report]![Combo7])
AND
(([Forms]![Cases Report].[Combo9])="<All>"));


Thanks a lot for your help
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:49
Joined
Oct 29, 2018
Messages
21,357
Re: Conditionally present a Drop down list

Hi,

I got it working, just added teh other 2 selection posibilities:

(((Cases.[Asigned Date]) Between [Forms]![Cases Report]![From] And [Forms]![Cases Report]![to])
AND
((Cases.Severity)=[Forms]![Cases Report]![Combo7])
AND
((Cases.Manager)=[Forms]![Cases Report]![Combo9]))
OR
((([Forms]![Cases Report].[Combo7])="<All>")
AND
(([Forms]![Cases Report].[Combo9])="<All>"))
OR
(((Cases.Manager)=[Forms]![Cases Report]![Combo9]) AND
(([Forms]![Cases Report].[Combo7])="<All>"))
OR
(((Cases.Severity)=[Forms]![Cases Report]![Combo7])
AND
(([Forms]![Cases Report].[Combo9])="<All>"));


Thanks a lot for your help
Hi. Glad to hear you got it to work. Good job!
 

Users who are viewing this thread

Top Bottom