G
Gottfried Lesigang
Hi everybody!
Using AccessXP, all available servicepacks installed.
I have a quite simple question - should be every days work ;-) but no
(convincing) solution found yet...
What it should be: My MainForm hands an object (selfdefined class) to a
popup form and opens it as a dialogbox. The user enters some values, these
values are validated and written into the properties of my class-object. The
dialogue disappears and my MainForm handles the (changed) values within the
object.
The Online-Help gives information and examples about "Load Object" and
"Form.Show vbModal" - what should be exactly what I need. This way just
doesn't work. Neither am I aloud to "Load" my DialogueForm, nor is there any
"Show"-method within my forms :-(
Later I found out about the "DoCmd.OpenForm" but there is no chance to put
MyClassObject into the "OpenArgs" (I realy don't want to serialise this!).
Than I found out about the variables beginning with "Form_" wich represent
my forms. It is no problem to define a public property within my dialogue
and I can set it to MyClassObject with:
Set Form_MyPopUp.MyClass = MyClassObject
A MessageBox within the "Load"-Event appears at this moment...
But there is no "Show"-method... And just making it visible doesn't make my
programm wait for the users reaction! The lines behind the ".visible=true"
are executed immedeately...
If I open the form with the DoCmd and "WindowMode;=acDialog" it is loaded
once again and it shows a second instance of my PopUpForm (I tested this
with a MessageBox within the "Load"-Event...)! This second instance doesn't
know about MyClassObject and changes made by the user don't affect the
"Form_MyPopUp" at all... I even have to close it twice :-((((
What I do at the moment? I defined a public sub "AnswerDialog(Changed as
Boolean)" within my MainForm. At the very last line of the calling "Sub" I
pass "MyClassObject" to "Form_MyPopUp" and make that visible. By closing the
PopUp my public "Sub" is called by the PopUp's EventProcedure. But this way
is super-ugly and pure nightmare to OOP!
So my simple question: How is this done?
TIA
Gottfried
Using AccessXP, all available servicepacks installed.
I have a quite simple question - should be every days work ;-) but no
(convincing) solution found yet...
What it should be: My MainForm hands an object (selfdefined class) to a
popup form and opens it as a dialogbox. The user enters some values, these
values are validated and written into the properties of my class-object. The
dialogue disappears and my MainForm handles the (changed) values within the
object.
The Online-Help gives information and examples about "Load Object" and
"Form.Show vbModal" - what should be exactly what I need. This way just
doesn't work. Neither am I aloud to "Load" my DialogueForm, nor is there any
"Show"-method within my forms :-(
Later I found out about the "DoCmd.OpenForm" but there is no chance to put
MyClassObject into the "OpenArgs" (I realy don't want to serialise this!).
Than I found out about the variables beginning with "Form_" wich represent
my forms. It is no problem to define a public property within my dialogue
and I can set it to MyClassObject with:
Set Form_MyPopUp.MyClass = MyClassObject
A MessageBox within the "Load"-Event appears at this moment...
But there is no "Show"-method... And just making it visible doesn't make my
programm wait for the users reaction! The lines behind the ".visible=true"
are executed immedeately...
If I open the form with the DoCmd and "WindowMode;=acDialog" it is loaded
once again and it shows a second instance of my PopUpForm (I tested this
with a MessageBox within the "Load"-Event...)! This second instance doesn't
know about MyClassObject and changes made by the user don't affect the
"Form_MyPopUp" at all... I even have to close it twice :-((((
What I do at the moment? I defined a public sub "AnswerDialog(Changed as
Boolean)" within my MainForm. At the very last line of the calling "Sub" I
pass "MyClassObject" to "Form_MyPopUp" and make that visible. By closing the
PopUp my public "Sub" is called by the PopUp's EventProcedure. But this way
is super-ugly and pure nightmare to OOP!
So my simple question: How is this done?
TIA
Gottfried