Data lookup (1 Viewer)

Dave_cha

Registered User.
Local time
Today, 00:47
Joined
Nov 11, 2002
Messages
119
I have a fairly simple report which is populated from one table (TAB1). The records in this table have several fields containing employee id's.
I would like to reference each instance of employee id in each record to an employee table (TAB2) and display their names in the report.
The obvious option is to join TAB2 to each user id field in TAB1 and build a fairly long SQL statement which includes the joins.
I would prefer however to build a function which would resolve each employee ID to their name as the records are being loaded into the report. This option would be easier to manage in the long run though I'm not sure if it's possible. Building a function to lookup the name is fairly straight forward for a one off lookup though I'm not sure how to do this where numerous records are being loaded into a report.

Hope I'm making sense.

Any help would be appreciated.

Rgd's,

Dave
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:47
Joined
Feb 19, 2002
Messages
43,346
It's time for you to learn a little about relational databases. The way you turn data back into information once you have properly normalized your database is with queries that JOIN the tables.

The join is very efficient. The DLookup() is not. Think about it - if you are showing only 100 records in your report - with the DLookup() you are asking Access to run an additional 100 queries!!! It only gets worse from there. The more records in your report, the slower it will be. You could process thousands of records with a join in the time it will take you to process hundreds with a domain function.
 

Dave_cha

Registered User.
Local time
Today, 00:47
Joined
Nov 11, 2002
Messages
119
Thanks Pat. I'm already using the Join option so I'll stick with it.

Rgd's,

Dave
 

Users who are viewing this thread

Top Bottom