Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

previous form 1

Status
Not open for further replies.

jordanh

Technical User
Nov 11, 2002
47
GB
Hi. I have 2 questions, I was going to put them in the same thread but thought it more useful to separate them.

Firstly... is there an easy way of checking which form 'referred' a user to the current one.

This is my problem, form A and form B can both cause form C to open.

When I leave form C I need to clear certain boxes on A or B, but different ones. So what I really need is an if statement like;

if lastform = A then
forms!A!box1 = Null
elseif lastform = B then
forms!B!box2 = Null
end if
docmd.close ...

can anyone help me!!

Thanks a lot,

Jordan

 
You need to use the OpenArgs property. I've not needed it for a while & can't remember the details, but it should all be in help.

Sharon
 
Yes, OpenArgs would be my first thought too.

The OpenArgs property can be SET using the DoCmd.OpenForm method

The opened form can then access the OpenArgs property.

Dispire what you might think , given the S on the end - you can, in fact, only send ONE argument.

So you could use

DoCmd.OpenForm "frmC", .. .. .. .. , "frmA"


Then in the On_Close event of the frmC

If OpenArgs = "frmA" Then
Forms!frmA!box1 = Null
Else
Forms!frmB!box2 = Null
EndIf


If you could contrive to have the controls on frmA and frmB using the same control names then you could simply use

Forms(OpenArgs)!boxName = Null





'ope-that-'elps



G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
bloody hell man you're a genius!!!

Thank you very much, it works a treat.

It's funny how you can trawl through help files, read all about the OpenForm command and not find out a scrap about incredibly useful things like OpenArgs.

Thank you once again, superb.

Jordan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top