From: Weeble on
I am trying to create a Function that will perform a calculation that will be
referenced by other Subs and or Functions. I would like to access data in a
table directly from within the Function. Is this possible? I can find nothing
that says yea or nay.

Thanks.
From: Douglas J. Steele on
Depending on what you're trying to do, you can either use the DLookup
aggregate function, or you can open a recordset and loop through it.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Weeble" <Weeble(a)discussions.microsoft.com> wrote in message
news:DE09F898-3015-4139-8115-028BE838BBCD(a)microsoft.com...
>I am trying to create a Function that will perform a calculation that will
>be
> referenced by other Subs and or Functions. I would like to access data in
> a
> table directly from within the Function. Is this possible? I can find
> nothing
> that says yea or nay.
>
> Thanks.


From: Jeanette Cunningham on
Yes, however your question is very general.
Many functions can be written to access data directly from a table.

To get data out of a table, you can use a DLookup.
Here's a simplified example-->

If DLookup("[TheField]", "TheTable") = True Then
'code to do something here
Else
'code to do something else here
End If



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


"Weeble" <Weeble(a)discussions.microsoft.com> wrote in message
news:DE09F898-3015-4139-8115-028BE838BBCD(a)microsoft.com...
>I am trying to create a Function that will perform a calculation that will
>be
> referenced by other Subs and or Functions. I would like to access data in
> a
> table directly from within the Function. Is this possible? I can find
> nothing
> that says yea or nay.
>
> Thanks.


From: Weeble on
Thanks Jeanette,

This didn't actually take care of what I was trying for, but it did satisfy
a subsequent issue. I'll post my solution to the initial issue later.

Again, Thanks.

Weeble

"Jeanette Cunningham" wrote:

> Yes, however your question is very general.
> Many functions can be written to access data directly from a table.
>
> To get data out of a table, you can use a DLookup.
> Here's a simplified example-->
>
> If DLookup("[TheField]", "TheTable") = True Then
> 'code to do something here
> Else
> 'code to do something else here
> End If
>
>
>
> Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
>
>
> "Weeble" <Weeble(a)discussions.microsoft.com> wrote in message
> news:DE09F898-3015-4139-8115-028BE838BBCD(a)microsoft.com...
> >I am trying to create a Function that will perform a calculation that will
> >be
> > referenced by other Subs and or Functions. I would like to access data in
> > a
> > table directly from within the Function. Is this possible? I can find
> > nothing
> > that says yea or nay.
> >
> > Thanks.
>
>
> .
>