Select Case Statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm looking to do a Select Case Statement that will show the user the status of the record
the feild will be Null or have a 1,2,3,4, or 5 in it

I did a modul with the following Code with no luck

Option Compare Databas
Option Explici

Function FTGStat(FTG, Status
Select Case FT
Case
FTGStat = "1st
Case
FTGStat = "2nd
Case
FTGStat = "3rd
Case
FTGStat = "Grad
Case
FTGStat = "FTG
Case Els
FTGStat = "Unknown
End Selec
End Function
 
KAnoe,

Please give an indication of how/where you are trying to use this function.
 
.... so, you are using the function in a query that the different from is
based on? What is the syntax? Where are the variables coming from?
Sorry, I still haven't got enough information to be able to help.
 
Keith,

Let's step back a moment. You made a user-defined function, FTGStat(),
which is apparantly not doing what you want. This function requires 2
parameters, FTG and Stayus, which I don't know what these are, but I
note that the function does not even use the Status parameter.
Whatever, a function will return a value, but inly if it is *used*
somewhere, somehow. If you want the value returned by the function to
show on the report card (which I presume is a report?), you will have to
use the function, either within the control source of an unbound textbox
on the report, or in a calculated field within the query that the report
is based on.

So, that's how I have been interpreting the problem. However, now that
I understand a little more about what you are trying to achieve, it
would seem that the use of this function is unnecessary. The built-in
function Choose() can do this job. In the query that the report card is
based on, make a calculated field like this (you didn't mention the name
of the field that the Option Group relates to, so I will suppose it is
called GradResult)...
GradStatus: Choose([GradResult],"1st","2nd","3rd","Grad","FTG")
.... and then use this GradStatus field on the report.

Does this help?
 
Change the function line to:
Function FTGStat(StrFtg As String)As String

Change The Select Case line to:
Select Case StrFtg

Call use function like this:
Me!MyFieldName = FTGStat(Forms!MyForm!NameOfOptionGroup)

Note: The form with the option group has to be open (can be not visible) to do
what you want.
 
Back
Top