Repost: Requery To Update Issues

G

Guest

Hello All:

Okay, i've been at this for days and still cannot come up withthe right
combination for this Requery Event Procedure.

Background: I have a main form with geographical info and several subforms
connected through command buttons. The subform has some of the same header
fields as the main form (i know i shouldn't have to duplicate fields but for
this application it is needed). So i setup my subform to auto populate the
fields with the same name using these expressions:

Command Button on Main form (Contract Profile) that opens subform (Contract
Review Assessment)

Private Sub Review_Assessment_Click()
On Error GoTo Err_Review_Assessment_Click
If IsNull(Me![ID]) Then
MsgBox "Enter Contract information before viewing Contract Review
Assessment form."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "Contracts Review Assessment", , , "[Contracts Review
Assessment]![ID] = Forms![Contract Profile]![ID]"
End If

Exit_Review_Assessment_Click:
Exit Sub

Err_Review_Assessment_Click:
MsgBox Err.Description
Resume Exit_Review_Assessment_Click
End Sub

Contract Review Assessment SubForm Record Source
SELECT DISTINCTROW [Contract Review Assessment].* FROM [Contract Review
Assessment] WHERE (([Contract Review Assessment].ID=forms![Contract
Profile]!ID));


Subform Filter:
[Contracts Review Assessment]![ID] = Forms![Contract Profile]![ID]


Subform BeforeInsert:
Private Sub Form_BeforeInsert(Cancel As Integer)
On Error GoTo Err_Form_BeforeInsert
Me![Contract_ Specialist] = [Forms]![Contract
Profile]![ContractSpecialistID]

Exit_Form_BeforeInsert:
Exit Sub

Err_Form_BeforeInsert:
MsgBox Err.Description
Resume Exit_Form_BeforeInsert
End Sub

SubForm On Activate:
Private Sub Form_Activate()
On Error GoTo Err_Form_Activate
Me.Requery

Exit_Form_Activate:
Exit Sub

Err_Form_Activate:
MsgBox Err.Description
Resume Exit_Form_Activate
End Sub

The above code got me as far as syncing the subforms by ID number and
keeping the SubForms records in the same order as the MainForm records. But
now i have issues with Updating the fields with the same name from the
MainForm to the SubForm once their is an edit on the Main Form. I've tried
each of the follwing statements in boththe Main Form, the Main Form Field i'm
attemtpting to update, as well as, the SubForm and Subform field i'm
attemtping to update to no avail:

Me![Contract Specialist].Form.Requery

Me![ContractSpecialistID].Form.Requery

me.sfrmContractSpecialist.requery

me.sfrmContractSpecialistID.requery

On Error GoTo Err_Form_AfterUpdate
Me![Contract_ Specialist] = [Forms]![Contract
Profile]![ContractSpecialistID].Form.Requery

Exit_Form_AfterUpdate:
Exit Sub

Err_Form_AfterUpdate:
MsgBox Err.Description
Resume Exit_Form_AfterUpdate

Can Anyone let me know what i'm doing wrong in my Requery?
 
G

Guest

Please disgregard i figured it out!

Ray said:
Hello All:

Okay, i've been at this for days and still cannot come up withthe right
combination for this Requery Event Procedure.

Background: I have a main form with geographical info and several subforms
connected through command buttons. The subform has some of the same header
fields as the main form (i know i shouldn't have to duplicate fields but for
this application it is needed). So i setup my subform to auto populate the
fields with the same name using these expressions:

Command Button on Main form (Contract Profile) that opens subform (Contract
Review Assessment)

Private Sub Review_Assessment_Click()
On Error GoTo Err_Review_Assessment_Click
If IsNull(Me![ID]) Then
MsgBox "Enter Contract information before viewing Contract Review
Assessment form."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "Contracts Review Assessment", , , "[Contracts Review
Assessment]![ID] = Forms![Contract Profile]![ID]"
End If

Exit_Review_Assessment_Click:
Exit Sub

Err_Review_Assessment_Click:
MsgBox Err.Description
Resume Exit_Review_Assessment_Click
End Sub

Contract Review Assessment SubForm Record Source
SELECT DISTINCTROW [Contract Review Assessment].* FROM [Contract Review
Assessment] WHERE (([Contract Review Assessment].ID=forms![Contract
Profile]!ID));


Subform Filter:
[Contracts Review Assessment]![ID] = Forms![Contract Profile]![ID]


Subform BeforeInsert:
Private Sub Form_BeforeInsert(Cancel As Integer)
On Error GoTo Err_Form_BeforeInsert
Me![Contract_ Specialist] = [Forms]![Contract
Profile]![ContractSpecialistID]

Exit_Form_BeforeInsert:
Exit Sub

Err_Form_BeforeInsert:
MsgBox Err.Description
Resume Exit_Form_BeforeInsert
End Sub

SubForm On Activate:
Private Sub Form_Activate()
On Error GoTo Err_Form_Activate
Me.Requery

Exit_Form_Activate:
Exit Sub

Err_Form_Activate:
MsgBox Err.Description
Resume Exit_Form_Activate
End Sub

The above code got me as far as syncing the subforms by ID number and
keeping the SubForms records in the same order as the MainForm records. But
now i have issues with Updating the fields with the same name from the
MainForm to the SubForm once their is an edit on the Main Form. I've tried
each of the follwing statements in boththe Main Form, the Main Form Field i'm
attemtpting to update, as well as, the SubForm and Subform field i'm
attemtping to update to no avail:

Me![Contract Specialist].Form.Requery

Me![ContractSpecialistID].Form.Requery

me.sfrmContractSpecialist.requery

me.sfrmContractSpecialistID.requery

On Error GoTo Err_Form_AfterUpdate
Me![Contract_ Specialist] = [Forms]![Contract
Profile]![ContractSpecialistID].Form.Requery

Exit_Form_AfterUpdate:
Exit Sub

Err_Form_AfterUpdate:
MsgBox Err.Description
Resume Exit_Form_AfterUpdate

Can Anyone let me know what i'm doing wrong in my Requery?
 

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