Form "relations"

B

Bill

I have a form that is opened by a couple of other
forms but is not in a parent/child relationship with
those forms. In that form then, how do I find the
name of the form that opened it? I.e., without the
parent/child relationship, something like
Me.Parent.Name isn't a valid use of the property.

Thanks,
Bill
 
N

Nick Coe \(UK\)

Pass the name of the calling form in a global variable.

Or have a hidden unbound control on the new form and set it
to contain the calling forms name just after the calling
form opens the new form. That is in the code that actually
opens the new form. I haven't done this for a few years so
could have remembered it wrong.

--
Nick Coe (UK)
http://www.alphacos.co.uk/ AccHelp + pAnimal
http://www.mrcomputersltd.com/ Repairs Upgrades

In Bill typed:
 
B

Bill

Nick,
I don't think I can do the latter suggestion, as I have to
open the form in acDialog which stops execution of
subsequent statements until the form closes. Or, at
least that's my understanding of one of the affects of
acDialog.
Bill
 
N

Nick Coe \(UK\)

I agree. That leaves you with using a global variable. Can
be tricky to make sure it is cleared and reset at the
appropriate places.

Another thought - How about having a table in which you
store the calling form name and the called form name?

Use DoCmd.RunSQL and you won't have to worry about
references and recordsets. In these circumstances I find it
helps to get the old pencil and paper out and rough out a
flow chart, questions or pseudo code of what I want to
happen.

1/ Delete any existing rows? Which ones?

2/ Append new rows or should I update?

3/ Do I want to store anything else with this, user name,
time called etc?

and so on until I can write the code out.

Personally I'd go for the global variable unless you need to
store the name(s) between sessions.

--
Nick Coe (UK)
http://www.alphacos.co.uk/ AccHelp + pAnimal
http://www.mrcomputersltd.com/ Repairs Upgrades

In Bill typed:
 
B

Bill

Nick,
Close to your idea of using global variables, it think it
would be just as simple to pass the invoking forms
name as an argument. The invocations are not
pervasive, so the code updates are comparatively
minimal.
Thanks for your thoughts,
Bill
 

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