Looking up a code on a Form

  • Thread starter Thread starter Cathy
  • Start date Start date
C

Cathy

In Access 2007, I have a form tied to a table (tblData). The detail section
of the form is used to update the table. One section of the Header displays
the criteria that was requested by the user prior to entering the form. One
of these elements is "Owner". The owner code is displayed from the table.
The problem is that the users won't know what this code means, and they would
want the full description (OwnerName) from the tblOwners. I can't link the
table on the form level, because that interferes with the user's ability to
update the information. How do I display the complete OwnerName from the
tblOwners?

Thank you!
 
Cathy -

Hide the Owner textbox, and add a OwnerName textbox that will contain the
owner name. The recordsource for this new textbox should be:
DLookup("[OwnerName]","[tblOwners]","[Owner] = " & Me.Owner)

You will need to use your control name for the Me.Owner, and the real field
name for [Owner] - maybe [OwnerID] or whatever. If your [Owner] field is
text instead of integer, you will need this instead:
DLookup("[OwnerName]","[tblOwners]","[Owner] = '" & Me.Owner & "'")
 
Daryl,

I didn't know about DLookUps! Thank you so much.

Daryl S said:
Cathy -

Hide the Owner textbox, and add a OwnerName textbox that will contain the
owner name. The recordsource for this new textbox should be:
DLookup("[OwnerName]","[tblOwners]","[Owner] = " & Me.Owner)

You will need to use your control name for the Me.Owner, and the real field
name for [Owner] - maybe [OwnerID] or whatever. If your [Owner] field is
text instead of integer, you will need this instead:
DLookup("[OwnerName]","[tblOwners]","[Owner] = '" & Me.Owner & "'")

--
Daryl S


Cathy said:
In Access 2007, I have a form tied to a table (tblData). The detail section
of the form is used to update the table. One section of the Header displays
the criteria that was requested by the user prior to entering the form. One
of these elements is "Owner". The owner code is displayed from the table.
The problem is that the users won't know what this code means, and they would
want the full description (OwnerName) from the tblOwners. I can't link the
table on the form level, because that interferes with the user's ability to
update the information. How do I display the complete OwnerName from the
tblOwners?

Thank you!
 
Back
Top