Read value from table

ejhatch

Registered User.
Local time
Today, 09:47
Joined
Oct 12, 2005
Messages
26
Hi All,

I know this will appear in a thread somewhere but I have searched in vain. I need to be able to read a value from a table. If the table looks as follows:

Name Text

default file path C:\temp

I am trying to get the code to find the record "Default file path" in the table called "settings" and then to return the actual value "c:\temp"

This record is not the only record in the table. There are many records.

Any guidance would be most grateful.

Thanks,

Evan
 
Hi ejhatch,

You can use the command dlookup to search in tables.

Code:
Dim varX As Variant
varX = DLookup("[Text]", "YourTableName", "[Name] = 'default file path' ")

Becare full with using colom names like "Name" and "Text"
 
Hi,

Thanks for your prompt replies and advice on the choice of names etc. I changed the names to make it more simple.

Basically I am running the code in a form and wish to assign a value to a variable. I need the code to go to a specific table, go down the first column till it finds a specific entry in that column and then return the value which is held adjacent to it in column 2. This value held in column 2 could be any value.

I have used the replies and they give me the desired result.

Thanks a stack,

Evan
 

Users who are viewing this thread

Back
Top Bottom