G
Gordon
I have a form (frmDiscs) which can be opened from several other forms.
In this particular case, it is called from a button on
frmVocalArrangements. On closing frmDiscs and after updating its
subform (frmDiscsSubform), I want to return to frmVocalArrangments at
the updated record.
To achieve this I put theis code in the load event of frmDiscSubform:
Private Sub Form_Load()
Dim frmCalling As Form
Set frmCalling = Screen.ActiveForm
End sub
After updating frmDiscs and its subform, I put the following code in
the on close event of the subform (frmDiscsSubform):
Private Sub Form_Close()
Dim intVocalistID As Integer, frmCalling As Form
On Error GoTo cmdCloseForm_Click_Err
If Me.Dirty Then Me.Dirty = False
If frmCalling.Name = "frmVocalArrangements" Then
intVocalistID = Me.fldVocalistID
'Requery the original "master" form
Forms!frmVocalArrangements.Requery
'Do Recordsetclone processing
Forms!frmVocalArrangements.RecordsetClone.FindFirst "fldVocalistID=" &
intVocalistID
If Not Forms!frmDiscs.Form.frmDiscsSubform.RecordsetClone.NoMatch Then
Forms!frmVocalArrangements.Bookmark = Forms!
frmVocalArrangements.RecordsetClone.Bookmark
End If
End If
CloseForm Me
cmdCloseForm_Click_Exit:
Exit Sub
cmdCloseForm_Click_Err:
MsgBox Error$
Resume cmdCloseForm_Click_Exit
End Sub
This all works fine except that I am getting an error message "Object
variable or With block variable not set ". What is causing this?
Thanks
Gordon
In this particular case, it is called from a button on
frmVocalArrangements. On closing frmDiscs and after updating its
subform (frmDiscsSubform), I want to return to frmVocalArrangments at
the updated record.
To achieve this I put theis code in the load event of frmDiscSubform:
Private Sub Form_Load()
Dim frmCalling As Form
Set frmCalling = Screen.ActiveForm
End sub
After updating frmDiscs and its subform, I put the following code in
the on close event of the subform (frmDiscsSubform):
Private Sub Form_Close()
Dim intVocalistID As Integer, frmCalling As Form
On Error GoTo cmdCloseForm_Click_Err
If Me.Dirty Then Me.Dirty = False
If frmCalling.Name = "frmVocalArrangements" Then
intVocalistID = Me.fldVocalistID
'Requery the original "master" form
Forms!frmVocalArrangements.Requery
'Do Recordsetclone processing
Forms!frmVocalArrangements.RecordsetClone.FindFirst "fldVocalistID=" &
intVocalistID
If Not Forms!frmDiscs.Form.frmDiscsSubform.RecordsetClone.NoMatch Then
Forms!frmVocalArrangements.Bookmark = Forms!
frmVocalArrangements.RecordsetClone.Bookmark
End If
End If
CloseForm Me
cmdCloseForm_Click_Exit:
Exit Sub
cmdCloseForm_Click_Err:
MsgBox Error$
Resume cmdCloseForm_Click_Exit
End Sub
This all works fine except that I am getting an error message "Object
variable or With block variable not set ". What is causing this?
Thanks
Gordon