Hi there, I am building a database which has UI with a main booking form and the sub forms for the fine details, I have the sub forms on tabs and have a check box make the tabs visible when it is checked. I have set the sub form to take the parent form's Ref no through a lookup but when I tab over the Subform is stuck on the record it was on last time I opened it and another instance of the subform has opened behind the the (popup) window containing the form. here's my code:
Private Sub chkEvent_AfterUpdate()
If Me![chkEvent] = True Then
[Event 1].Visible = True
'Next line is where I think the problem might be
DoCmd.OpenForm "BookEvent1", acNormal, , , acFormAdd
Forms![BookEvent1]![ParentBooking].Value = [OrderID]
Else
'Next set of procedures not complete, gonna have it delete the record if the box is unchecked'
If (MsgBox("Cancel all events for this booking? this operation cannot be undone", vbOKCancel) = vbOK) Then
[Event 1].Visible = False
Else
Me![chkEvent] = True
End If
End If
End Sub
I think the problem is in the DoCmd.OpenForm "BookEvent1"... line. I assume i need to refer to the "BookEvent1" form through a path that includes the parent form ("BookingForm")
One other detail, I don't want to fix this with an "on open moveTo" jobbie if it means that if I make a new record for that subform it automatically jumps past the sub-booking record that belongs to the main booking's record. I'd like to correct within this Sub if possible
Hopefully I haven't jumbled up my explanation beyond understanding.
Hope you can help.
EDIT -
Thought I should add, The "BookEvents1"form isn't actually a subform I created it separately from the main form and it is grouped with it's own recordset. Thanks.
Private Sub chkEvent_AfterUpdate()
If Me![chkEvent] = True Then
[Event 1].Visible = True
'Next line is where I think the problem might be
DoCmd.OpenForm "BookEvent1", acNormal, , , acFormAdd
Forms![BookEvent1]![ParentBooking].Value = [OrderID]
Else
'Next set of procedures not complete, gonna have it delete the record if the box is unchecked'
If (MsgBox("Cancel all events for this booking? this operation cannot be undone", vbOKCancel) = vbOK) Then
[Event 1].Visible = False
Else
Me![chkEvent] = True
End If
End If
End Sub
I think the problem is in the DoCmd.OpenForm "BookEvent1"... line. I assume i need to refer to the "BookEvent1" form through a path that includes the parent form ("BookingForm")
One other detail, I don't want to fix this with an "on open moveTo" jobbie if it means that if I make a new record for that subform it automatically jumps past the sub-booking record that belongs to the main booking's record. I'd like to correct within this Sub if possible
Hopefully I haven't jumbled up my explanation beyond understanding.
Hope you can help.
EDIT -
Thought I should add, The "BookEvents1"form isn't actually a subform I created it separately from the main form and it is grouped with it's own recordset. Thanks.
Last edited: