Query and Textbox Value

sougata666

Registered User.
Local time
Today, 13:49
Joined
May 1, 2016
Messages
36
Hello Access Gurus,

I want to assign the text of a textbox (in a form) to a particular row in a query.

For example, suppose the query has the following output

EmployeeID(key) LastPosn
------------------- -----------
12356 Manager
14567 CEO
18574 Chief Engineer

I want the textbox to display LastPosn based on the employee i select using a combobox in the form.
 
either use the following:

on your textbox control source:

=nz(dlookup("LastPosn","queryName","employeeID = " & [comboname]), "")

or use the after update event of your combo

private sub combo_afterupdate()
me.textbox = nz(dlookup("LastPosn","queryName","employeeID = " & me.[comboname]), "")
end sub

or

private sub combo_afterupdate()
'if the there is second column in your combo
'with LastPosn in it.
me.textbox = me.combo.column(1)
end sub
 
Last edited:
Thank you sir. It works.
 
you're welcome!
 

Users who are viewing this thread

Back
Top Bottom