Multiple Email Address

A

Andrea

I have a form which allows up to 5 email addresses per
client. I want to code the form so that the user cannot
enter values in the 2nd, 3rd, 4th or 5th fields without
first entering a value in the 1st field.

Can you help?
 
S

Sandra Daigle

Hi Andrea,

The real problem is that your data is not normalized. Instead of having 5
fields in one table you should have a new table with the ClientID (or
primarykey field from the original table) and a single email field. Then the
user can enter as many email addresses as necessary. You can add a number
field if the email addresses need to be ranked.

UnNormalized table
-------------------------
Clientid
LastName
FirstNAme
Email1
Email2
....
Email5

Normalized Client
------------------
Clientid
LastNAme
FirstName

Normalized Email
 
T

Tony_VBACoder

You would have to put the following code in either the
On_Current event of a form or in the OnChange,
AfterUpdate, OnExit, etc... events of the 1st field on
your Form. Basically, you are checking if the 1st field
is NULL or empty, and then disable the other 4 fields.
You may want to make this a SubRoutine because you may be
calling it from more than one place.

With Me
If IsNull(.txtField1) Or Len(.txtField1) = 0 Then
' Clear out the fields before we disable it
.txtField2 = ""
.txtField3 = ""
.txtField4 = ""
.txtField5 = ""
' Disable the Fields
.txtField2.Enabled = False
.txtField3.Enabled = False
.txtField4.Enabled = False
.txtField5.Enabled = False
Else
.txtField2.Enabled = True
.txtField3.Enabled = True
.txtField4.Enabled = True
.txtField5.Enabled = True
End If
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top