Populate field from a Main Form to subform field (1 Viewer)

Joe8915

Registered User.
Local time
Today, 05:05
Joined
Sep 9, 2002
Messages
820
There are 3 words that are dangerous a staff meeting:
Can you do?
Is this possible
Why can’t we
Then why do I say, “It most likely can be done”.

This is what I am trying to accomplish.
I have a form with a subform. I would like to populate a field in the subform, from the Main Form.

The field in the Main Form is called EDRate.
The field in the Subform is called DRate.
The subform is called FrmWorkProduction subform.
The Main form is called Frm ADD/Edit Payroll S3
In the Main form I used the After Update and used the following:
Private Sub EDRate_AfterUpdate()
Me.FrmWorkProduction SubForm!DRate = Me.EDRate
End Sub

I get error the recordset is not updateable

I know what it means, (it has to do with my relationships) but I can’t figure out what is the best way to fix.

The subform:
Link Fields are as follows:

Link Master Fields: ID
Link Child Fields: wrkdescp_ID


I will attach the db, to help understanding the problem.

Thanks all for taking the time to take a look and view

O yes the next time, I will keep my mouth shut!!!!!!!!!
 

Attachments

  • Phase2E.zip
    185.7 KB · Views: 71

Isskint

Slowly Developing
Local time
Today, 12:05
Joined
Apr 25, 2012
Messages
1,302
The code is not written correctly to address a control on a subform. The general format is Forms!MainForm!SubFormName.Form!FieldName

Me.FrmWorkProduction SubForm!DRate = Me.EDRate should be;

Forms![Frm ADD/Edit Payroll S3]!FrmWorkProduction.Form!DRate = Me.EDRate

The SubFormName should be the name of the subform control NOT the name of the table that is the subforms recordsource (unless this is the same).
 

Joe8915

Registered User.
Local time
Today, 05:05
Joined
Sep 9, 2002
Messages
820
Isskint, thanks for chiming in. I pasted in the code as suggested. I am still getting the error " the recordset is not updateable"

Private Sub EDRate_AfterUpdate()
Forms![Frm ADD/Edit Payroll S3]!FrmWorkProduction.Form!DRate = Me.EDRate
End Sub
 

Isskint

Slowly Developing
Local time
Today, 12:05
Joined
Apr 25, 2012
Messages
1,302
Can you post the structure of the relavent tables and their relationships?
 

Joe8915

Registered User.
Local time
Today, 05:05
Joined
Sep 9, 2002
Messages
820
Isskint, thanks for the quick reply. I have uploaded the db, to make it more clear. By any chance were you able to view the db?
 

Isskint

Slowly Developing
Local time
Today, 12:05
Joined
Apr 25, 2012
Messages
1,302
Not from this PC, i only have A03:confused:. I can have a look l8r from another PC though.
 

Joe8915

Registered User.
Local time
Today, 05:05
Joined
Sep 9, 2002
Messages
820
Isskint, that would be great. I think it would be alot better if you can review the db for yourself and you will get a better idea where the issue is hanging up.
 

Joe8915

Registered User.
Local time
Today, 05:05
Joined
Sep 9, 2002
Messages
820
I just updated the db. I was able to address my problem so what and it works on a Main form and a subform, but nothing is link. So it has to do with many link fields. I will attach the revised db.

Any help would be most appreciated
 

Attachments

  • Phase2E1.zip
    186.8 KB · Views: 61

Isskint

Slowly Developing
Local time
Today, 12:05
Joined
Apr 25, 2012
Messages
1,302
Unfortunatley i am unable to work on this:confused:. This is in A2010 and i only have A2007:banghead:. I can open but am unable to enter data.
 

Joe8915

Registered User.
Local time
Today, 05:05
Joined
Sep 9, 2002
Messages
820
Isskint, thats a bummer. I can give you all the relationships that are involved and the links.
 

Joe8915

Registered User.
Local time
Today, 05:05
Joined
Sep 9, 2002
Messages
820
Isskint, I hope you can understand this. I think I covered about everything. If you think you need additional information, please let me know. Once again thanks for taking the time to view this.

Main Form: Name FRM ADD/Edit Payroll S3
2 Tables are involved with the Main Form
1. TblEEFullName
2. TblEmp.
Join Properties:
Tables:
TbleEEFFull Name:
TblEmp:
Only include rows where the joined fields from both tables are equal.
SELECT TblEmp.*, TblEmp.Employee, TblEmp.Proddtd, TblEEFullName.EDRate, TblEEFullName.EPRate, TblEEFullName.EWVRate FROM TblEEFullName INNER JOIN TblEmp ON TblEEFullName.EEfullname = TblEmp.Employee ORDER BY TblEmp.Employee;

SubForm: Name FrmWorkProduction subform
Only 1 table is involved with the Subform
Table Name: TblWorkdescription
Subform Field link
Master Fields: = ID (comes from the Main form and tblEMP)
Child Fields:= Workdescp_ID (comes from the tblWorkdescription)
Field in the subform is named DRate.
 

Users who are viewing this thread

Top Bottom