User defined Function to use data direct from table???

  • Thread starter Thread starter Weeble
  • Start date Start date
W

Weeble

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


.
 
Back
Top