Basically I have a Main Form with 2 SubForms and I bookmark the first subforms recordset (called InvSubForm) to the value of InvNo in the second subform which I am in presently. Two issues arise!
1. When the main form opens it gives me an error the it cannot find the form/property. I therefore added the "On Error Resume Next", because once the form is open I can move around and it will bookmark the first subform to the proper value. I was wondering if there is way without the On Error to correct this.
2. IS AN URGENT MATTER
In the last ELSE of the condition (code below) if the field InvNo in the current record is null, I want to set the subform number 1 (called InvSubForm) to add a new record. I tried many different ways, but nothing seems to work. I don't know how to unset the recordset from the previous bookmark or how to move it to a new record.
Any help is appreciatted!
1. When the main form opens it gives me an error the it cannot find the form/property. I therefore added the "On Error Resume Next", because once the form is open I can move around and it will bookmark the first subform to the proper value. I was wondering if there is way without the On Error to correct this.
2. IS AN URGENT MATTER
In the last ELSE of the condition (code below) if the field InvNo in the current record is null, I want to set the subform number 1 (called InvSubForm) to add a new record. I tried many different ways, but nothing seems to work. I don't know how to unset the recordset from the previous bookmark or how to move it to a new record.
Any help is appreciatted!
Code:
Private Sub Form_Current()
On Error Resume Next
If Nz(Me.InvNo, "") <> "" Then
Forms!POFnlForm!InvSubform.Form.RecordsetClone.FindFirst "[InvNo] ='" & Nz(Me.InvNo, "") & "'"
Forms!POFnlForm!InvSubform.Form.Bookmark = Forms!POFnlForm!InvSubform.Form.RecordsetClone.Bookmark
ElseIf Nz(Me.InvNo, "") = "" And Nz(Forms!POFnlForm!InvSubform.Form.NewInvNo.Tag, "") <> "" Then
Forms!POFnlForm!Invoicesubform.Form.RecordsetClone.FindFirst "[InvoiceNo] = '" & Forms!POFnlForm!Invoicesubform.Form.NewInvNo.Tag & "'"
Forms!POFnlForm!Invoicesubform.Form.Bookmark = Forms!POFnlForm!Invoicesubform.Form.RecordsetClone.Bookmark
Else
Forms!POFnlForm!Invoicesubform.Form.SetFocus
DoCmd.GoToRecord , , acNewRec
End If
End Sub