Monday, July 23, 2012

How to get a specific record from a table using DLookUP

Hei!
I love DLookUP!

I did not know that with a simple function like this you can retrieve a record from a table with a simple command.

Easier to do that to say:

 My application: I need to create a profile table containing local settings for the DB.
1. I create the table named "local_settings"with the following fields:
- key
- version
- <other fields>

2. Created a record where:
key = "localsettings"
version = version of the database
<other fields>

Now .... If you need to get the DB version or any other data from this table DLookUp makes it easy:

version = DLookup("verison", "local_settings", "[key] = 'localsettings'")

that is:

DLookup("FieldName" , "TableName" , "Criteria = 'xxxx'")

PS. Criteria you can use variables.
The result is the first record matching the criteria

So ... if you don't want to use many rows of scripting .... that's the solution!
ciao ciao

No comments:

Post a Comment

Microsoft Teams doesn't open

 Hello! My Microsoft Teams stop working! Searching .... I found this solution that worked: Delete the content of: C:\Users\<profile>\A...