Entering the same value into two table fields at the same time

M

mezzanine1974

Say that there is a table which has 2 fields (A, B)
There is a form [Form1] (data entry type) to enter data for A by
`TextBoxA`.
There is also one more `TextBoxB` which is Not Visible.

My target is to record the value of (entered thtough `TextBoxA`) into
B field of the table as well.
So I write down a code "Before Insert" of the Form1 that:

" Form_Form1.TextBoxB = Form_Form1.TextBoxA "

It is not recording A values into the field B... Where am I wrong? Can
you help me please?
 
M

mezzanine1974

Sory !!!
When I write down the same code into `OnExit` of TextBoxA, it is
working...!!
 
T

tina

yes, that will work, but i'd recommend that you use TextBoxA's AfterUpdate
event, rather than the Exit event - that way the code runs only when data is
actually entered or edited in TextboxA, rather than every time you Exit the
control.

though i must say that it seems very strange to me that you are storing
duplicate data in your table.

hth
 
M

mezzanine1974

Hello Tina,

Related table refers to "RequsitionTable"
TextBoxA - refers to Project Manager who makes the requsition.
TextBoxB- dublicates the Project Manager in the same table

TextBoxA actually receives its data from the related table
(TblProject). (it is combo box actually to prevent user from mistake)

I considered that if the Project Manager will change in the future, I
would like to keep original Project Manager in the dublicated field
(TextBoxB) who made requsition before. Otherwise, when the Project
Manager is changed in the TblProject, all its related data in the
RequsitionTable to be updated automatically including items from very
beginning of the table.

You may help me to build an adequate relationship for this issue?
Because I am aware of that I am breaking some basic rules of the
database approach.
 

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