How to forbid opening subform

  • Thread starter samotek via AccessMonster.com
  • Start date
S

samotek via AccessMonster.com

Can i forbid opening the subform by itself ? I want my subform to be opened
only by the main form and i somebody wants to open the subform not to allow
it
 
R

Rick Brandt

samotek said:
Can i forbid opening the subform by itself ? I want my subform to be
opened only by the main form and i somebody wants to open the subform
not to allow it

Try referring to the subform's Parent property in the Open event. When NOT
opened as a subform that will raise an error. You can then have an error handler
that cancels the Open event.

Private Sub Form_Open(Cancel As Integer)

On Error GoTo ErrHandler

Me.Parent.Name

Egress:
Exit Sub

ErrHandler:
Cancel = True
Resume Egress
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top