Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Null Values in Drop Down Boxes

Status
Not open for further replies.

sandybam

Technical User
Mar 20, 2001
43
0
0
US
Hi All,

I have a form that I use to run roll up reports by Colleague, Team or Auditor. The team and auditor report is the same but the colleague report is different. I would like to use the same form and report button to run either report. Here is the code I am using for my report run button. I cannot seem to get the rptrollupreportsimple report to run.

If Me.SearchName.Value = "" Then
DoCmd.OpenReport "rptrollupreportsimple", acViewPreview
Else
DoCmd.OpenReport "rptrollupreportsimplecolleagueonly", acViewPreview
End If
End Sub

What I’m trying to say is that if the SearchName drop down box is Null then run the rptrollupreportsimple otherwise if the SearchName is not Null then run the rptrollupreportsimplecolleagueonly. The SearchName field is a drop down box and I think the problem is that I am not using the null value correctly.

Any suggestions?
 
Hi!

Have you tried testing for isnull?

[tt]If isnull(Me!SearchName.Value) Then[/tt]

or perhaps the listindex

[tt]If Me!SearchName.listindex=-1 Then[/tt]

Roy-Vidar
 
Thank you! The isnull did the trick! I appreciate your quick response.

Sandy
 
Sandy,

Glad Roy assisted with your problem - he does great work!

For future reference, null is not a value, it is a condition.

Think of it as "I don't know"

For more info: Thread181-832106



HTH,
Bob [morning]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top