RE: Function Trouble

From: Chris Nebinger (anonymous_at_discussions.microsoft.com)
Date: 05/04/04


Date: Tue, 4 May 2004 09:58:03 -0700

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
> >.
> >
>.
>



Relevant Pages

  • Re: SQL for Counting 1 total of 4 fields - normalization issue onl
    ... successful union query. ... Chris F ... "Duane Hookom" wrote: ... records for each person that is a member of a group. ...
    (microsoft.public.access.queries)
  • Re: Better approach for common business problem ? (long post)
    ... "Chris Webb" wrote: ... > client with data before the query is run. ... >> aggregations you could hit instead of one. ... especially if you are partitioning by month. ...
    (microsoft.public.sqlserver.olap)
  • Re: Access Query
    ... "Group" is a reserved keyword and should be avoided when naming your ... "KARL DEWEY" wrote: ... "Chris" wrote: ... SQL of the query? ...
    (microsoft.public.access.queries)
  • Re: Access Query
    ... "Bob Barrows" wrote: ... "KARL DEWEY" wrote: ... "Chris" wrote: ... SQL of the query? ...
    (microsoft.public.access.queries)
  • Re: Stuck on tables....
    ... Vincent and Chris, ... I do need to query hearings by date. ... The database is to track parole ... parole, day parole, post suspension hearing, parole to out of state, porole ...
    (microsoft.public.access.tablesdbdesign)