How Move trhee o more rows from a subform to another subform

L

ldiaz

Hi all.

with contributor help of this group I have made a DataBase to pay
Production Bonus to the people, ..
in the Main form named: BonusForm I filter the Department,Area and Location
once made this the group of person are displayed in the Subform Named:
IDEmployeesubform with these Field
EmployeeID
#Employee
Name
DepartmentID
AreaID
ClasificationID
Active (These are checkBox)
Absence (These are checkBox)

what I want is to Move these group of person to another subform named:
BonusEmployeesubform with these Field

EmployeeID
Bonus $(This Need to be calculated from a field of
BonusForm [Rate]*[QtyProduced])
HrsWorked (This need to have same data as a field of BonusForm
[Hrs])

but if one row in the IDEmployeesubform is checked as TRUE in the [Absence]
field the Bonus and HrsWorked of BonusEmployeesubform need to be filled as 0


please I need your help, I will appreciate so much.
 
N

Naeem

Dear Idiaz,
on the control that give you the True value once it's checked (i guess it's
a checkbox) put an event on the afterupdate event as follows:

click the the object, i guess it's named absence_checkbox, and then add
these as a procedure in the afterupdate event of the control.

if me.absence_checkbox = true then
me.bonus = null ' or any other value you wish to insert
me.hrsworked = null ' or any other value
else
'is there anything else you want to do if the value is False? add them here
end if

so access will check the value of the checkbox whenever the value is changed
and does what you want accordingly.
Naeem
 
L

ldiaz

Hi Naeem..

I understood your answer but my first question was:
how move the three or more records from IDEmployeesubform to
BonusEmployeesubform.

could you help me please

--
Lorenzo Díaz
Cad Technician


Naeem said:
Dear Idiaz,
on the control that give you the True value once it's checked (i guess it's
a checkbox) put an event on the afterupdate event as follows:

click the the object, i guess it's named absence_checkbox, and then add
these as a procedure in the afterupdate event of the control.

if me.absence_checkbox = true then
me.bonus = null ' or any other value you wish to insert
me.hrsworked = null ' or any other value
else
'is there anything else you want to do if the value is False? add them here
end if

so access will check the value of the checkbox whenever the value is changed
and does what you want accordingly.
Naeem



ldiaz said:
Hi all.

with contributor help of this group I have made a DataBase to pay
Production Bonus to the people, ..
in the Main form named: BonusForm I filter the Department,Area and Location
once made this the group of person are displayed in the Subform Named:
IDEmployeesubform with these Field
EmployeeID
#Employee
Name
DepartmentID
AreaID
ClasificationID
Active (These are checkBox)
Absence (These are checkBox)

what I want is to Move these group of person to another subform named:
BonusEmployeesubform with these Field

EmployeeID
Bonus $(This Need to be calculated from a field of
BonusForm [Rate]*[QtyProduced])
HrsWorked (This need to have same data as a field of BonusForm
[Hrs])

but if one row in the IDEmployeesubform is checked as TRUE in the [Absence]
field the Bonus and HrsWorked of BonusEmployeesubform need to be filled as 0


please I need your help, I will appreciate so much.
 
N

Naeem

Dear Lorenzo,
What's the reason behind moving those records into the other table "bonus"
it is not capable of keeping them.
i guess you have two sub-forms in your main form opened. what you need to do
it to connect the 2nd subform to the Employee ID of the main form too.
This will record bonuses to the employee into the table. and if you want to
see all the information in both subform in one record, you need to make a
query, in this query you have to connect values of both tables via employee
ID and insert as many as fields you want to it.
you shall avoid keeping same values in two tables and that's what you have
done.
i hope this helps.
I am new here so i really need good explanation in order to be helpful.
Naeem


ldiaz said:
Hi Naeem..

I understood your answer but my first question was:
how move the three or more records from IDEmployeesubform to
BonusEmployeesubform.

could you help me please

--
Lorenzo Díaz
Cad Technician


Naeem said:
Dear Idiaz,
on the control that give you the True value once it's checked (i guess it's
a checkbox) put an event on the afterupdate event as follows:

click the the object, i guess it's named absence_checkbox, and then add
these as a procedure in the afterupdate event of the control.

if me.absence_checkbox = true then
me.bonus = null ' or any other value you wish to insert
me.hrsworked = null ' or any other value
else
'is there anything else you want to do if the value is False? add them here
end if

so access will check the value of the checkbox whenever the value is changed
and does what you want accordingly.
Naeem



ldiaz said:
Hi all.

with contributor help of this group I have made a DataBase to pay
Production Bonus to the people, ..
in the Main form named: BonusForm I filter the Department,Area and Location
once made this the group of person are displayed in the Subform Named:
IDEmployeesubform with these Field
EmployeeID
#Employee
Name
DepartmentID
AreaID
ClasificationID
Active (These are checkBox)
Absence (These are checkBox)

what I want is to Move these group of person to another subform named:
BonusEmployeesubform with these Field

EmployeeID
Bonus $(This Need to be calculated from a field of
BonusForm [Rate]*[QtyProduced])
HrsWorked (This need to have same data as a field of BonusForm
[Hrs])

but if one row in the IDEmployeesubform is checked as TRUE in the [Absence]
field the Bonus and HrsWorked of BonusEmployeesubform need to be filled as 0


please I need your help, I will appreciate so much.
 
J

John Vinson

Hi Naeem..

I understood your answer but my first question was:
how move the three or more records from IDEmployeesubform to
BonusEmployeesubform.

could you help me please

You're making a very common mistake: assuming that subforms contain
data. They don't!

Forms and Subforms are *just tools* - windows onto the data stored in
Tables.

If you really want to move records, you should use an Append query
followed by a Delete query to move the records from the table bound to
IDEmployeesubform to the table bound to BonusEmployeesubform.

HOWEVER - in a properly designed database, with normalized tables,
this operation should NOT BE NEEDED!

Could you explain what tables these are, and how they are related? and
why you feel that you need to "move" the data from one table to
another?

John W. Vinson[MVP]
 
N

Naeem

Data in two tables are different, so i dont think he can delete them from one
table and append them to the other table.
in some cases. people do this. in order to separate for instance posted
transactions from active non posted ones in order to reduce network traffic
and making queries to run faster and it is not the case here.
 
A

Arvin Meyer [MVP]

The data in the second "subform" is only differs because of the
calculations. As John pointed out, the design of this table structure isn't
normalized. There is no need to move records at all. They can be calculated
in a query which would be used as the recordsource of a subform. And, as
John pointed out, moving records should be done by appending them to a
destination and deleting them from a source.

Your reference to doing this appears to be the use of a temporary table for
data waiting to be posted. Typically, this isn't done to reduce network
traffic (although it may have that effect), it is done to finalize
transactions in an accounting system. There are other uses, as well, but
they are very specialized. For instance, I sometime use temporary tables to
gather data from different sources to do a report.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
L

ldiaz

Hi all. thank you for your comments.

Here is what I have:
a Form where I have Comboboxs filtering Datas in the IDEmployeesubform once
done this, I select the Product that this Line produced and the Product has a
RateXday and HrsWorked and according to these Datas a $Bonus is given to the
Employee but as the IDEmployeesubform is used as Filter only, the rows of
Employees Selected need to ve moved to the BonusEmployeesubform where the
$Bonus will be updated.

The BonusEmployeesubform has relationship with the FormBonus.

is it possible?

Thanks and I appreciate so much your help.
 

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