Hi and TIA, I have the criteria for one of my fields set to the return
value of this function. When I view the result in the immediate window it
appears to be the exact value I would use if I directly typed it in the
criteria section. However, if I do type it in I get the results I expect,
but if I set the criteria = to the return value of the function no records
are returned. Am I missing something here? Any help is appreciated.
Thanks!
Option Explicit
Const conRPoolCVN = """A"" Or ""B"" Or ""J"""
Const conRPoolL = """A"" Or ""C"" Or ""D""Or ""U"""
Const conAVDLRCVN = "<>""A"" And <>""B"" And <>""J"""
Const conAVDLRL = "<>""A"" And <>""C"" And <>""D"" And <>""U"""
Public Function SetPoolCode() As String
Dim intSiteType As Integer
Dim intReportType As Integer
dim str as String
intSiteType = Forms!frmExpedi te_Criteria.opt Class
intReportType = Forms!frmExpedi te_Criteria.opt Report
Select Case intReportType
Case 1 'AVDLR
Select Case intSiteType
Case 1 'CVN
str = conAVDLRCVN
Case 2 'L-Class
str = conAVDLRL
Case 3 'Other
str = ""
End Select
Case 2 'R-Pool
Select Case intSiteType
Case 1 'CVN
str = conRPoolCVN
Case 2 'L-Class
str = conRPoolL
Case 3 'Other
str = ""
End Select
End Select
SetPoolCode = str
Debug.Print str
End Function
--
Reggie
"Half this game is 90% mental."
----------
value of this function. When I view the result in the immediate window it
appears to be the exact value I would use if I directly typed it in the
criteria section. However, if I do type it in I get the results I expect,
but if I set the criteria = to the return value of the function no records
are returned. Am I missing something here? Any help is appreciated.
Thanks!
Option Explicit
Const conRPoolCVN = """A"" Or ""B"" Or ""J"""
Const conRPoolL = """A"" Or ""C"" Or ""D""Or ""U"""
Const conAVDLRCVN = "<>""A"" And <>""B"" And <>""J"""
Const conAVDLRL = "<>""A"" And <>""C"" And <>""D"" And <>""U"""
Public Function SetPoolCode() As String
Dim intSiteType As Integer
Dim intReportType As Integer
dim str as String
intSiteType = Forms!frmExpedi te_Criteria.opt Class
intReportType = Forms!frmExpedi te_Criteria.opt Report
Select Case intReportType
Case 1 'AVDLR
Select Case intSiteType
Case 1 'CVN
str = conAVDLRCVN
Case 2 'L-Class
str = conAVDLRL
Case 3 'Other
str = ""
End Select
Case 2 'R-Pool
Select Case intSiteType
Case 1 'CVN
str = conRPoolCVN
Case 2 'L-Class
str = conRPoolL
Case 3 'Other
str = ""
End Select
End Select
SetPoolCode = str
Debug.Print str
End Function
--
Reggie
"Half this game is 90% mental."
----------
Comment