jsmith1611
Registered User.
- Local time
- Today, 08:41
- Joined
- Jan 7, 2009
- Messages
- 23
I have a parent form with two levels of child forms. I have set all forms to default to AllowEdits = False. When I click an Edit button on the main form, it sets the AllowEdits to True for itself and both child forms like this:
Private Sub editRec_Click()
Me.AllowEdits = True
Me![type].Form.AllowEdits = True
Me![type].Form![Sequence].Form.AllowEdits = True
End Sub
This all works fine. I have a save button that also resets the AllowEdits back to False for the parent and all child forms like this:
Private Sub saveRec_Click()
On Error GoTo Err_saveRec_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
MsgBox "Record Saved."
Me.AllowEdits = False
Me![type].Form.AllowEdits = False
Me![type].Form![Sequence].Form.AllowEdits = False
Exit_saveRec_Click:
Exit Sub
Err_saveRec_Click:
MsgBox Err.Description
Resume Exit_saveRec_Click
End Sub
This also works fine. The problem I am experiencing is when I click the addRec button for the parent form to add a new record. I can add a new parent record, but the child records are not available. When I click the addRec button, a message says “You can’t go to the specified record.” Here is the code for addRec on the parent form:
Private Sub addRec_Click()
On Error GoTo Err_addRec_Click
DoCmd.GoToRecord , , acNewRec
Me.tapeNum.SetFocus
Exit_addRec_Click:
Exit Sub
Err_addRec_Click:
MsgBox Err.Description
Resume Exit_addRec_Click
End Sub
When I click OK, I can add the parent record, but I still can’t see the child records or add a child record. This all worked fine before I made the change to the forms not allowing edits.
I have tried calling the addRec procedure for the subform, but no success there either. What am I missing here?
Thanks,
Josh
Private Sub editRec_Click()
Me.AllowEdits = True
Me![type].Form.AllowEdits = True
Me![type].Form![Sequence].Form.AllowEdits = True
End Sub
This all works fine. I have a save button that also resets the AllowEdits back to False for the parent and all child forms like this:
Private Sub saveRec_Click()
On Error GoTo Err_saveRec_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
MsgBox "Record Saved."
Me.AllowEdits = False
Me![type].Form.AllowEdits = False
Me![type].Form![Sequence].Form.AllowEdits = False
Exit_saveRec_Click:
Exit Sub
Err_saveRec_Click:
MsgBox Err.Description
Resume Exit_saveRec_Click
End Sub
This also works fine. The problem I am experiencing is when I click the addRec button for the parent form to add a new record. I can add a new parent record, but the child records are not available. When I click the addRec button, a message says “You can’t go to the specified record.” Here is the code for addRec on the parent form:
Private Sub addRec_Click()
On Error GoTo Err_addRec_Click
DoCmd.GoToRecord , , acNewRec
Me.tapeNum.SetFocus
Exit_addRec_Click:
Exit Sub
Err_addRec_Click:
MsgBox Err.Description
Resume Exit_addRec_Click
End Sub
When I click OK, I can add the parent record, but I still can’t see the child records or add a child record. This all worked fine before I made the change to the forms not allowing edits.
I have tried calling the addRec procedure for the subform, but no success there either. What am I missing here?
Thanks,
Josh