[AccessD] Same form, different actions

Darren DICK darrend at nimble.com.au
Sun Jan 29 16:29:25 CST 2006


Hi John
Anyone feel free to jump in if I have this wrong 

The open Args are quite useful, but tacked on the end of a Do.cmd statement they
don't do much
Just text or numbers (usually) tacked on the end of an OpenForm Do.Cmd statment

The real 'power' is in the interpretation at the other end

Eg at the 'originating or calling' end
Docmd.openform "frmSomeName",,,,,, "OpenAsDA"
Or
Docmd.openform "frmSomeName",,,,,, "OpenAsADA"
Or
Docmd.openform "frmSomeName",,,,,, "OpenAsJUD"
Or
Docmd.openform "frmSomeName",,,,,, "OpenAsVIC"

Etc - you get the idea


So....
AT the other end
IE in the OnOpen, OnCurrent etc of "frmSomeForm"
You could do lots off things because your Destination form will 'hear' and 'see'
the "OpenAsDA" etc opening Argument passed to it
But like I said earlier, how you handle it at the Destination end is crucuial

So you could have a big (or small) select case or if statement
Determining the OpenArgs passed

Eg

Select case me.openArgs

Case  "OpenAsDA"
	'Open as Ass DA form
	me.cboSubjects.rowsourse = "Select *from Subjects where UsreType = 1"

Case "OpenAsDA"
	'Open as DA form
	me.cboSubjects.rowsourse = "Select *from Subjects where UsreType = 2"
"OpenAsJUD"
	'Open as Judge form
	me.cboSubjects.rowsourse = "Select *from Subjects where UsreType = 3"
"OpenAsVIC"
	'Open as Victim form
	me.cboSubjects.rowsourse = "Select *from Subjects where UsreType = 4"
Case else

End select


Or you could replace the Case statements from "OpenAsDA"
To the actual values from the OptionGroup in the calling form
EG
Select Case Forms!callingForm!SomeOptionGroup

Case 1
	'Open as Ass DA form
	me.cboSubjects.rowsourse = "Select *from Subjects where UsreType = 1"
Case 2
	'Open as DA form
	me.cboSubjects.rowsourse = "Select *from Subjects where UsreType = 2"
And so on

So...
Hope this makes sense

See ya

Darren




More information about the AccessD mailing list