RE: Function Trouble
From: Derek Wittman (anonymous_at_discussions.microsoft.com)
Date: 05/04/04
- Next message: Chris Nebinger: "Grid and ADO"
- Previous message: Carlee: "creating efficient code...advice?"
- In reply to: Chris Nebinger: "RE: Function Trouble"
- Next in thread: david epsom dot com dot au: "Re: Function Trouble"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 4 May 2004 11:26:08 -0700
Acutally, you did. My old HEIGHT function was wrong, and your suggesting Variant over STRING made a difference in the long run. (besides, anyone else who looks up the same thing may find your suggestion helpful as well).
Now, though, I'm working on incorporating a little human common sense into a distance calculation. I'm mapping warehouse aisles in Access by way of linear distances. But that's another topic...
Thanks again, Chris!
Derek
----- Chris Nebinger wrote: -----
I'm glad I totally did not help......
Seriously, glad you got it working.
Chris Nebinger
>-----Original Message-----
>Duh! I forgot that I already had a function named
HEIGHT. Thus, the ambiguous name... Thanks anyway, Chris!
>>Derek
>> ----- Derek Wittman wrote: -----
>> Chris,
> I changed the query and the function as suggested
(variant), and I still get the same error message. Since
FROM is a SQL reserved word, I even changed that, and no
improvement.
>> Do you have any other ideas?
>> Thank you!
> Derek
>> ----- Chris Nebinger wrote: -----
>> You need to set up the Function as:
>> Public Function Height(strFrom as String) as
String
>>> Then Call it by:
>> Select tblPltMvs.From, tblPltMvs.To, height
> (tblPltMvs.From) AS Expr1
>>> One thing. Strings can not handle null
values. If you
> have any records without the From field filled
in, you
> will get an error. Change that by:
>> Public Function Height(strFrom as Variant) as
Variant
>>>> Chris Nebinger
>>>-----Original Message-----
>>Good morning,
>>I have been getting an error: "Ambigous name.
in query
> expression height()" when I try to run an
Access query
> with SQL code:
>>>SELECT tblPltMvs.From, tblPltMvs.To, height()
AS Expr1
>>FROM tblPltMvs;
>>>My VBA function is below. It is supposed to
return a
> value (height) that gives the height of the
pallet from
> the floor based on [from] slot number. Slots
are
> designated as such:
>>>Aisle (1-2 letters)
>>Bay (numbers)
>>Slot (1 letter or 2 numbers) - letters denote
RESERVE
> slots and numbers denote PICK/SELECTION slots.
>>>"DOOR" is at the center of the dock
>>>Public Function Height()
>>Dim FLevel As String
>>If Right([from], 1) <> "E" And Right([from],
1) <> "F"
> And Right([from], 1) <> "G" And Right([from],
1) <> "T"
> Then
>> If [from] = "DOOR" Then FLevel = "0"
>> If Right([from], 2) = "10" Then FLevel
= "A"
>> If Right([from], 2) = "20" Then FLevel
= "C"
>>Else: FLevel = Right([from], 1)
>>End If
>>Select Case FLevel
>>Case "A"
>> Height = 0
>>Case "C"
>> Height = 52.5
>>Case "1", "2", "3", "4", "5"
>> Height = 0
>>Case "E"
>> Height = 103
>>Case "F"
>> Height = 155
>>Case "G"
>> Height = 206.5
>>Case "T"
>> Height = 258
>>End Select
>>End Function
>>>>Can someone please tell me what I am doing
wrong? I need
> to pass the 'from' slot number into the
function, but even
> when I put it as height(from as string), it's
not working.
>>>Thank you in advance!
>>Derek
>>.
>>>.
>
- Next message: Chris Nebinger: "Grid and ADO"
- Previous message: Carlee: "creating efficient code...advice?"
- In reply to: Chris Nebinger: "RE: Function Trouble"
- Next in thread: david epsom dot com dot au: "Re: Function Trouble"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|