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

  • Thread starter Thread starter mezzanine1974
  • Start date Start date
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?
 
Sory !!!
When I write down the same code into `OnExit` of TextBoxA, it is
working...!!
 
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
 
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.
 
Back
Top