No Selection Made - If Statement in Macro (1 Viewer)

Madmart1gan

Registered User.
Local time
Today, 07:06
Joined
Mar 19, 2014
Messages
12
I have a form with two cascading list boxes. When the selection in the final list box is made, the user presses a button that opens a report using a macro on the button. I'm trying to create an If statement in the macro that says, if no selection is made in the final list box, display a message box and stop the macro, otherwise, open the report.

I'm just not sure how to properly execute that. I tried

Code:
[COLOR=red]If [Forms]![fReportBuilder]![cmbo_SelectFactSheet] Is Null
[/COLOR] 
 [I]Then Message Box[/I]
 [I]Stop Macro[/I]
 
[I]Else[/I]
 
 [I]Open Report[/I]

I think I'm just not getting that If statement correct. Any ideas?
 

liddlem

Registered User.
Local time
Today, 14:06
Joined
May 16, 2003
Messages
339
If the button is on the same form as the combo's, you could say
if isnull(me.cmbo_SelectFactSheet) then
blah
else
blah blah
endif

You could also set the buttons 'visible' property to 'no' in the form.
On the 'AfterUpdate' event of the combo, you could say
if isnull(me.cmbo_SelectFactSheet) then
me.button.visible=false
else
me.button.visible=true
endif
 

Madmart1gan

Registered User.
Local time
Today, 07:06
Joined
Mar 19, 2014
Messages
12
Thank you for the reply, I will give that a shot!
 

Users who are viewing this thread

Top Bottom