Problem editing Data in form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created 2 forms. One I call subfrmSerialNumber, which is a Summary
form, the other frmRepair, is a detail. I use a query to feed the forms. I
have a cmd button on Summary, tied to the click event, that opens the detail
to the same data(record). The used the wizard to creat this

I can't write to the Detail. I found that if I close the frmSummary, it
works. I would have thought the Wizard would have taken this into
consideration. I tried to close the frmSummary by adding a Docmd.Close to
the code used in that event. I get a error saying it cant find object???
(Maybe it thinks its closed already)

I can also get it to work by setting no locks on fthe detail, but that
doesnt work well in this environment.

Private Sub cmdOpensubfrmSNCheck_Click()
On Error GoTo Err_cmdOpensubfrmSNCheck_Click
DoCmd.Close
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmRepair"

stLinkCriteria = "[RMA]=" & "'" & Me![RMA] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdOpensubfrmSNCheck_Click:
Exit Sub

Err_cmdOpensubfrmSNCheck_Click:
MsgBox Err.Description
Resume Exit_cmdOpensubfrmSNCheck_Click

End Sub

I hope this makes sense.
 
Try putting the DoCmd.Close after you open the other form and make
sure you specify which form to close. Example: DoCmd.Close acForm,
"MyForm"
 
Thanks Penguin.
Sorry I didnt get back sooner. It has worked fine.

Penguin said:
Try putting the DoCmd.Close after you open the other form and make
sure you specify which form to close. Example: DoCmd.Close acForm,
"MyForm"

I have created 2 forms. One I call subfrmSerialNumber, which is a Summary
form, the other frmRepair, is a detail. I use a query to feed the forms. I
have a cmd button on Summary, tied to the click event, that opens the detail
to the same data(record). The used the wizard to creat this

I can't write to the Detail. I found that if I close the frmSummary, it
works. I would have thought the Wizard would have taken this into
consideration. I tried to close the frmSummary by adding a Docmd.Close to
the code used in that event. I get a error saying it cant find object???
(Maybe it thinks its closed already)

I can also get it to work by setting no locks on fthe detail, but that
doesnt work well in this environment.

Private Sub cmdOpensubfrmSNCheck_Click()
On Error GoTo Err_cmdOpensubfrmSNCheck_Click
DoCmd.Close
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmRepair"

stLinkCriteria = "[RMA]=" & "'" & Me![RMA] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdOpensubfrmSNCheck_Click:
Exit Sub

Err_cmdOpensubfrmSNCheck_Click:
MsgBox Err.Description
Resume Exit_cmdOpensubfrmSNCheck_Click

End Sub

I hope this makes sense.
 
Back
Top