Fill text boxes with data from another text box

P

Porkchop

I have a form that has two sections. Section 1 has orginator name, address,
city state, zip. Section two has owner name, address, city, state, and zip.
If orginator and owner are the same, I want to just hit a button or check
mark to copy data from section one to section two. Can this be done, and how
would you do it.

Thanks for your help-
Porkchop.
 
S

Sprinks

Porkchop,

To copy data from one control (and, hence, field, if the form control source
is set to the name of a field in the form's underlying record source), put
the following in the AfterUpdate event procedure of the checkbox:

If MyCheckBox = True Then
' Set the second control's value to that of the first
Me![MySecondControl] = Me![MyFirstControl]
Else
' User has unselected the checkbox; set to blank
Me![MySecondControl] = ""
End If

It sounds, however, that you may have another issue, depending on what this
form is for. It's likely that you should have a People table that has the
name, address, city, state, zip, phone, etc., and that you should only need
to add the primary key of that table into the Originator and Owner fields of
this form. That way, all of the fields related to the person are stored only
once, avoiding data anomolies caused by typos or minor variations in
spelling. For example, if different data entry people enter "GE", "G.E.",
"Genl. Electric", "General Electric", than any searches or totals of data in
the underlying record source of the form will have to look for all of these
permutations.

What kind of data is the form capturing?

Hope that helps.
Sprinks
 
P

Porkchop

Sprinks,
This is actually a sub form. This sub form captures manifest information.
The Orginator of the load and the owner of the load or facility. Somtimes
the orginator is the same as owner and somtimes not. I just wanted to make
life easier. Yes I agree about the People table, but not all are aready in,
as we get new customers and shippers. So this table is called Manifest info.
The main form is called Daily log, and table is called Daily log. And TYPOS
abound!

So now the question is, where do I enter the code, in code builder? Do I
need to change code to fit my sub form? I admit I'm little new to this.

Thanks for your help!
Porkchop





Sprinks said:
Porkchop,

To copy data from one control (and, hence, field, if the form control
source
is set to the name of a field in the form's underlying record source), put
the following in the AfterUpdate event procedure of the checkbox:

If MyCheckBox = True Then
' Set the second control's value to that of the first
Me![MySecondControl] = Me![MyFirstControl]
Else
' User has unselected the checkbox; set to blank
Me![MySecondControl] = ""
End If

It sounds, however, that you may have another issue, depending on what
this
form is for. It's likely that you should have a People table that has
the
name, address, city, state, zip, phone, etc., and that you should only
need
to add the primary key of that table into the Originator and Owner fields
of
this form. That way, all of the fields related to the person are stored
only
once, avoiding data anomolies caused by typos or minor variations in
spelling. For example, if different data entry people enter "GE", "G.E.",
"Genl. Electric", "General Electric", than any searches or totals of data
in
the underlying record source of the form will have to look for all of
these
permutations.

What kind of data is the form capturing?

Hope that helps.
Sprinks


Porkchop said:
I have a form that has two sections. Section 1 has orginator name,
address,
city state, zip. Section two has owner name, address, city, state, and
zip.
If orginator and owner are the same, I want to just hit a button or check
mark to copy data from section one to section two. Can this be done, and
how
would you do it.

Thanks for your help-
Porkchop.
 

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