value typed in text box triggers value in other text box

SoxPats83

Registered User.
Local time
Today, 07:37
Joined
May 7, 2010
Messages
196
i understand this may be a bit off topic, but i have a page within access that the end user will type in the id of a coworker, and what i would like is when a specific id is typed, a disabled/locked text box nearby will populate with that coworker's supervisor. any help would be appreciated. thanks.
 
In the AfterUpdate event of that control, you can use the DLookup to locate the supervisor's name and place it in the locked control

It should look something similar to the following (after correct substitution) ...


Private Sub txtControlName_AfterUpdate()

Me.txtLockedControlName = Nz(DLookup("[SupervisorFieldName]", _
"tblTableNametoFindSupervorNameIn", _
"[ForeignKeyinCurrentTable] = " & Me.txtControlNamewithKey), _
"No Supervisor"

End Sub

Again, this is air code, but should get you going (check the Help for DLookup, too). I added the Nz function because Access will wig out if DLookup returns a null value, so this should handle it for you.

HTH,
-dK
 

Users who are viewing this thread

Back
Top Bottom