closing a main form via a Subform?

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

Guest

Hi i have a main search form which looks up values/results that are displayed
in a subform. Within the subform , for each record there is a 'view' button
that opens up the specific record in question (by matching the ID fields).
However, since its created via the form button wizard, it uses an event
procedure in VBA, and i have no idea what code to write that will close the
entire/main(and subform) after the 'view' button is pressed.

I tried creating a macro with Open form and close form function but the
expression i created in the WHERE property didnt work as it that would match
the PKs to show a specific record.

Any ideas?
Thanks
 
i have no idea what code to write that will close the
entire/main(and subform) after the 'view' button is pressed.

Try invoking the Code Builder in the close button's click event:

Private Sub cmdClose_Click()
DoCmd.Close acForm, Me.Parent.Name
End Sub

John W. Vinson[MVP]
 
Thanks that worked

John Vinson said:
Try invoking the Code Builder in the close button's click event:

Private Sub cmdClose_Click()
DoCmd.Close acForm, Me.Parent.Name
End Sub

John W. Vinson[MVP]
 
Back
Top