Question : Attach Text Box and Combo Box text

I have a text box where a user enters an email address.  There could be multiple email domains involved, so, after the text box, there is a combo box for the user to select which domain they're on.

How do I attach the email address (text box) to the selected combo box text as one element in the table's record for that email network?

Ex:

TXT BOX:  EMAIL   |  CBO:  DOMAIN 1
                                            DOMAIN 2

User is on DOMAIN 1, so, in the record for this user in the table it displays as "EMAIL@DOMAIN 1".

The domain choice cbo is unbound.

This is simple to do with a standard line of text (i.e. a single email domain), but I can't figure it out for a choice of domains.

Answer : Attach Text Box and Combo Box text

Is the textbox bound? If so, then do this in the AfterUpdate event of the combo:

Me.YourTexbox = Me!Email & "@" & Me.YourCombo

Assuming you have a field named "Email" in the underlying recordset. Also, make SURE to name the "email" control something other than "Email", since that could confuse Access. Instead, name it something like "txMyEmail", and bind it to the correct field.

This can cause issues, however, since after setting this value one time, your Email field would contain a value like "[email protected]". If I then select ANOTER domain, it would do this:

"[email protected]@antotherdomain.com"

You can parse off anything before the "@" sign, if need be ...

A better question is this - why not just store the Email and Domain in the table, and then build the email as needed? You can easily do this vis a query:

FullEmail: Email & "@" & Domain

Assuming your base table has two fields.
Random Solutions  
 
programming4us programming4us