populate text box based on combo box value

Danny

Registered User.
Local time
Today, 18:35
Joined
Jul 31, 2002
Messages
143
Greetings,
I’d like to auto populate a textbox (txtDAUEmail) based on selection made in a combo box (cboDAUNM):

If John Doe1 is selected from the combo box, then the textbox should auto fill the analyst’s e-mail address. e.g. John.Doe1@emiladdress.com

I changed the row source of the combo box to CALCULATE the email address:
Code:
SELECT tblLOGIN.USERID, tblLOGIN.INVNM, tblLOGIN.PWD, IIf([INVNM]=” John Doe1”,” John.Doe1@emiladdress.com”,Iif([INVNM]=” John Doe2”,” John.Doe2@emiladdress.com”,Iif([INVNM]=” John Doe3","analyst3@ John.Doe3@emiladdress.com ",""))) AS EMail
FROM tblLOGIN
WHERE (((tblLOGIN.PWD) Like "ad*") AND ((tblLOGIN.STATUS)="A"))
ORDER BY tblLOGIN.INVNM;


Result:
USERID INVNM PWD Email
001 John Doe1 **** John.Doe1@emiladdress.com
002 John Doe2 **** John.Doe2@emiladdress.com
003 John Doe3 **** John.Doe3@emiladdress.com

TIA
 
Just bring the email address as an additional hidden column and then assign to the control

Code:
Me.Textbox = Me.cboUser.Column(x)

x is the column number, but column index starts at 0, so third column would be (2)

HTH
 
Problem with your approach is... if the user changes their email address, you have to change code?
 
Hi,
I tried
Code:
=[ComboboxName].[Column](#)
but it wasn’t doing anything.

After watching the video link provided by Uncle Gizmo ‘Get Info From a Combo-box” http://www.niftyaccess.com/combo-box/, I changed the column count and the column width of my combo box, and it’s working nicely.

Thanks a lot everyone!

Regards,
 
Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom