Populate a variable from a table

M

MH UK

I have a table within the database with single entry.
I would like to extract that data and populate it onto a variable declared
in a module but am having trouble referencing the field.
I'm sure that it is straightforward but......

Thanks in advance.
 
K

Klatuu

If you are saying the table has only one row and you want the value of a
field in a variable in your module, then this will work:

Dim VarSomeVariable as Variant

varSomeVariable = DLookup("[SOME_FIELD]", "SomeTable")
 
M

MH UK

Thanks. This works fine.



Klatuu said:
If you are saying the table has only one row and you want the value of a
field in a variable in your module, then this will work:

Dim VarSomeVariable as Variant

varSomeVariable = DLookup("[SOME_FIELD]", "SomeTable")

MH UK said:
I have a table within the database with single entry.
I would like to extract that data and populate it onto a variable declared
in a module but am having trouble referencing the field.
I'm sure that it is straightforward but......

Thanks in advance.
 
B

basstbone

AWESOME :)))))) Glad I found this post :)
Worked for me too :)
Thank you all !!! :)

MH UK said:
Thanks. This works fine.



Klatuu said:
If you are saying the table has only one row and you want the value of a
field in a variable in your module, then this will work:

Dim VarSomeVariable as Variant

varSomeVariable = DLookup("[SOME_FIELD]", "SomeTable")

MH UK said:
I have a table within the database with single entry.
I would like to extract that data and populate it onto a variable declared
in a module but am having trouble referencing the field.
I'm sure that it is straightforward but......

Thanks in advance.
 
Top