You posted code from IsRaneAll::
Case Else
MsgBox "cannot determine IsRangeall"
IsRangeAll = False
End Select
you can just remove the message box, one problem solved. If you are
seeting
a field to IsRangeAll then:
Case else
IsRangeAll = ""
End Select
Alright, that gives me a new message box that says "cannot determine
IsRangeAllBS". Then when I enter through about 100 of these messages
the
debugger takes me to a line in the IsRangeLS function...it highlights
the
first line of the code:
Public Function IsRangeLS(ByVal lngNum As Long) As String
Select Case lngNum
Case 31 To 50
IsRange = "31-50"
Case 51 To 100
IsRange = "51-100"
Case 11 To 30
IsRange = "11-30"
Case 101 To 250
IsRange = "101-250"
Case Is > 250
IsRange = "GT 250"
Case 9 To 10
IsRange = "9-10"
Case 7 To 8
IsRange = "7-8"
Case 5 To 6
IsRange = "5-6"
Case 1 To 4
IsRange = "1-4"
Case 0 To 0
IsRange = "0"
End Select
End Function
Is there any way that instead of the message box, I can just have False
or
an N/A or something returned? All of the records will not be able to
fit
the
variable requirements, so those records I would just like to have that
field
blank or N/A or something like that.
:
That comes from :
MsgBox "cannot determine IsRangeall"
Which is the else condition in:
Select Case BrnType & Left$(BOD_CODE, 1)
So lets try: changing the msgbox to:
MsgBox "cannot determine IsRangeall, code = " & BrnType &
Left$(BOD_CODE,
1)
I will start a new thread like you mentioned. I changed my
function(s)
so
they all return as String and I get a message that says "Cannot
determine
IsRangeAll"
:
We are getting closer.
You should declare the Function AS whatever type you are trying to
return.
STRING looks about right, and I would expect you function to do
something,
which may even be right, if you make that change. Given your state
of
confusion, you may have to change IsRangeSF etc too. Count the
bruises,
count the lessons.
A function behaves as though it is a variable of the type that you
assign
to it, although it can change the parameters passed to it if you so
desire
(not generally a good idea.)
Inside the function IsRangeall you set IsRangeAll as though it were
a
variable, outside IsRangeAll you use IsRangeAll(...) as though it
was
a
read
only variable.
Start a new thread if you have any further questions.
There in lies my inexperience, I guess. No I am not trying to
return
TRUE
/
FALSE, I just don't know what I'm doing.

I originally has
everything
as
String and that didn't work. Someone suggested that I have the
functions
as
Boolean. I have 3 fields in a query that are being looked at to
assign
a
specific value to based on the 3 functions, IsRangeSF, IsRangeLS,
and
IsRange.
:
Now you have declared Israngeall as Boolean, and you are still
trying
to
assign a string to it.
Are you trying to get IsRangeAll to return TRUE / FALSE ?
If so, give an example condition.
I have changed Boolean to String in that function. This
function
is
called
on by another function, that is now giving me a run time error
'13':
type
mismatch. The debugger is highlighting this: IsRangeAll =
IsRange(INVOICES)
in the function below: I appreciate any help you can provide.
Public Function IsRangeAll(ByVal INVOICES As Long, ByVal
BrnType
As
String,
ByVal BOD_CODE As String) As Boolean
Select Case BrnType & Left$(BOD_CODE, 1)
Case "FR"
IsRangeAll = IsRangeSF(INVOICES)
Case "FN"
IsRangeAll = IsRangeLS(INVOICES)
Case "BR"
IsRangeAll = IsRange(INVOICES)
Case "BN"
IsRangeAll = IsRangeLS(INVOICES)
Case Else
MsgBox "cannot determine IsRangeall"
IsRangeAll = False
End Select
End Function
:
You have defined IsRange as Boolean in your function, and are
then
attempting to assign string values to it. Try:
Public Function IsRange(ByVal lngNum As Long) As String
HTH,
Rob
Would you be able to help me with my new problem?......
I get another run time error '13': type mismatch
It is highlighting this line of my IsRange function -
IsRange
=
"1-2"
The whole function is below. I'm not sure where to go with
this
error.
Public Function IsRange(ByVal lngNum As Long) As Boolean
Select Case lngNum
Case 33 To 50
IsRange = "33-50"
Case 51 To 100
IsRange = "51-100"
Case 11 To 12
IsRange = "11-12"
Case 13 To 15
IsRange = "13-15"
Case 16 To 17
IsRange = "16-17"