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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Case 2

Status
Not open for further replies.

TimTDP

Technical User
Feb 15, 2004
373
ZA
In Access 2000 I have the following:

Declarded in a module
Public strReportReference As String
Public strReportCommonName as string

In Form
Select Case strReportReference
Case Not IsNull(strReportReference)
strReportCommonName = "Common Report"

Case strReportReference <> ""
strReportCommonName = ""
End Select

If strReportReference = "" the select case works.

If strReportReference = "Test", the select case does not work.
Any ideas why?
 
I think you should not re-use the variable you are evaluating in the Select Case in the individual Case clauses. Also, both cases test for the same value (i.e. something not equal to a null string in strReportReference), so there's no point to the Select Case.

HTH,

Ken S.
 
Hi TimTDP,

Try this If Statement...

In Form

If IsNull(strReportReference) Then
strReportCommonName = ""
Else
strReportCommonName = "Common Report"
End If

Carl


AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
How are ya TimTDP . . .

I'd expect your code to work if Nulls were accounted for.
Try this:
Code:
[blue]   SelCase Trim(strReportReference & "")
      Case <> ""
         strReportCommonName = "Common Report"
      Case Else
         strReportCommonName = ""
End Select[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top