Help

S

SF

I have 3 forms say frmA, frmB and frmC. I don't want user to open frmC
unless then following condiction are met such as frmC can only be opened
from a bottun on frmA or frmB (because I have an ID field on frmC that
refer to a control either on frmA or frmB)

Also how can I detect from which form (frmA or frmB) the bottun is pressed?

SF
 
B

BruceM

In answer to your first question, you could use the Startup options to start
with a specific form when the database is opened and to exclude the database
window from the Startup options. You may do well do start with a
switchboard form that gives the user several options about which form or
report to open. A close button on that form would close the database rather
than just the form. If you allow users to close forms without providing
them a way to either select another form or exit the database they could
become irritated.

For your second question, you could pass an OpenArgs value when opening frmC
from frmA:
DoCmd.OpenForm "frmC", , , , , , "frmA"

or if you are not passing other arguments:

DoCmd.OpenForm "frmC", OpenArgs:="frmA"

Substitute "frmB" when opening frmC from frmB.

In the Load event of frmC:

MsgBox Me.OpenArgs

That probably is not what you want to do with the value; rather, it is a
demonstration of how to obtain the value in frmC. Your actual use of
OpenArgs will depend on just what you want to do with the value.

You could run into difficulties if the user can open frmC from frmB if it
has already been opened from frmA, and vice versa.
 

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