VBA to evaluate a report field

krberube

just beyond new
Local time
Today, 15:41
Joined
Jan 14, 2005
Messages
142
Good morning All,
First, I want to Thank Ken Hig for helping me on using CASE SELECT for something similar yesterday.

I have a report with a field RCSN, This can have several different values in it. Based on these values I want an unbound text field "RCModel" to display certain values:
1 - If Length of RCSN = 9 then RCModel = Symbol S-24
2 - If RCSN = 832505 then RCModel = Cisco A/B
3 - If RCSN = 838692 then RCModel = Cisco A/B/G
and about 4 others that I can work out after I get these 3 working.

I was thinking of doing a module to evaluate this. Here is my first try at the code:

Function RadioCard(RCSN As String) As String
If RCSN = "832505" Then
RCModel = "Cisco A/B"
ElseIf RCSN = "838692" Then
RCModel = "Cisco A/B/G"
Else
GoTo Symbol
End If

Symbol:
If Len(RCSN) = "9" Then
RCModel = "Symbol S-24"
End If

End Function

It does compile, I use =RadioCard([RCSN]) in my unbound control source, but I still get no value when I run the report.

My question is, Am I going about this the right way, or is there better way?
If this is a good idea maybe someone could help with the code?

Thanks in advance
Kevin
 
Code:
Function RadioCard(RCSN As String) As String

if len(RCSN)=9 then
   RadioCard = "Symbol S-24"
   Goto Exit_RadioCard
End if

if RCSN = "832505 then
   RadioCard = "Cisco A/B"
   Goto Exit_RadioCard
End if

if RCSN = "832505 then
   RadioCard = "Cisco A/B/G"
   Goto Exit_RadioCard
End if

Exit_RadioCard:

End Function

???
 
you are the MAN!
So I guess I had somewhat of the right idea, just not sure how to go about these things yet. this forum has been great!
Thanks again Ken
 
Cool - I'm so glad I can help someone every once in a while :D
 
:D and manage to participate in the watercooler at the same time
 
Delicate balance - trying to keep col & rich in line :D
 
:p and probably endulge in full time employment at the same time...do you drink red bull?? :p
 
You know I never tried any - does it work?
 

Users who are viewing this thread

Back
Top Bottom