populate text box based on combo box value (1 Viewer)

Danny

Registered User.
Local time
Today, 13:23
Joined
Jul 31, 2002
Messages
140
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
 

Gasman

Enthusiastic Amateur
Local time
Today, 18:23
Joined
Sep 21, 2011
Messages
14,367
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
 

Gasman

Enthusiastic Amateur
Local time
Today, 18:23
Joined
Sep 21, 2011
Messages
14,367
Problem with your approach is... if the user changes their email address, you have to change code?
 

Danny

Registered User.
Local time
Today, 13:23
Joined
Jul 31, 2002
Messages
140
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,
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:23
Joined
Oct 29, 2018
Messages
21,499
Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom