Re: Switch is overloaded!
From: tina (nospam_at_address.com)
Date: 04/29/04
- Next message: Ted Allen: "Need help to remove tbas, carriage retrun, and other!!!"
- Previous message: zooeyhall: "Queries and reports run slow"
- In reply to: Bonnie: "Switch is overloaded!"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 29 Apr 2004 20:09:46 GMT
if both the Div values and the Contract values are sequential - with no
gaps - as in your example below, try using the following public function:
Public Function isContract(ByVal lngDiv As Long) As String
Dim lngCnt As Long
lngCnt = CLng(lngDiv) - 813
isContract = CStr(2466 + lngCnt)
End Function
if either (or both) Div/Contract values are not absolutely sequential, use a
Select Case statement instead:
Public Function isContract(ByVal strDiv As String) As String
Select Case strDiv
Case "813"
isContract = "2467"
Case "814"
isContract = "2468"
'etc, etc, etc.
'you may want to use a Case Else line also, to assign a Contract
value
'to any "missed" Div value.
End Select
End Function
*make sure you test on a copy of your db before running it on live data*
hth
"Bonnie" <Hambrick@discussions.microsoft.com> wrote in message
news:62a301c42e1d$d63eb6a0$a301280a@phx.gbl...
> Hi there! Using A02 in XP. Need to import some text with
> Division numbers and need to convert them to the Contract
> numbers so I can run an extract file. I have:
>
> GP: switch([Div]="813","2466", [Div]="814","2467", [Div]
> ="815","2468", [Div]="816","2469", [Div]="817","2470",
> [Div]="818","2471", [Div]="819","2472", [Div]
> ="930","2455", [Div]="931","2456", [Div]="932","2457",
> [Div]="933","2458", [Div]="934","2459", [Div]
> ="935","2460", [Div]="936","2461", [Div]="938","2462",
> [Div]="939","2463", [Div]="940","2464", [Div]
> ="942","2465",true,[Div])
>
> I get an error that the expression I entered is too
> complex. Am I doing this in the wrong place?
>
> Thanks in advance for any help or advice. I luv u guys!!!
- Next message: Ted Allen: "Need help to remove tbas, carriage retrun, and other!!!"
- Previous message: zooeyhall: "Queries and reports run slow"
- In reply to: Bonnie: "Switch is overloaded!"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|