VBA Form-Opening Question (How to set acDialog)

nunca_habla

New member
Local time
Today, 06:39
Joined
Mar 21, 2006
Messages
7
I'm wanting to do the following steps:
1) open form
2) set some fields in this form via VB
3) make the form acDialog so that code waits for the form to be closed

My problem:
How can I make a form acDialog after opening? Is this possible?

I don't want to:
- use global variables
- use table entries
- use OpenArgs

My code looks like:
---------------------------------------------------------------
Code:
docmd.openform "TheDialogForm"

forms!TheDialogForm!SomeField="..."
forms!TheDialogForm!SomeOtherField="..."
...
forms!TheDialogForm!StillAnotherField="..."

forms!TheDialogForm.PopUp = True ' <-- this does NOT work!
---------------------------------------------------------------
 
Open your form with acDialog and then reach back into the previous form through the Forms collection in the OnLoad event of the second form.
 
This get method would be nice but i have some connection open and pulling data from somewhere else so I have to put not get the data

The data is stored in string variables (>64k) so the openargs does not work
and the data is NOT in the forms.controls of any form!

With the suggested method I would have to (slow!) copy 64k several times (by setting it in fields in this form and then copying them to the other form with onload, btw. data cannot be stored in one single control field so i have to split it and concat it ... slow slow slow) or make the variables global (ugly!)
 
It doesn't comply to:
nunca_habla said:
3) make the form acDialog so that code waits for the form to be closed

if you run:
Code:
docmd.openform "Testform"
msgbox("test 1")
forms!testform.modal=true
msgbox("test 2")

The msgboxes appear after another without the code to wait for the Testform to close


I even tried this code but it is VERY SLOW and not usable:
Code:
docmd.openform "Testform"
msgbox("test 1")
DO 
DoEvents 
LOOP WHILE isFormOpen("Testform")
msgbox("test 2")
(isFormOpen is a function which checks if a form is open and returns true or false)
 
Last edited:
This get method would be nice but i have some connection open and pulling data from somewhere else so I have to put not get the data
I'm not quite sure what this means but I'm sure you are aware that Access is *not* multi-threaded so it can only do one thing at a time.
The data is stored in string variables (>64k) so the openargs does not work and the data is NOT in the forms.controls of any form!
If you don't mind me asking, why is the data in a string variable and not a memo field somewhere?
With the suggested method I would have to (slow!) copy 64k several times (by setting it in fields in this form and then copying them to the other form with onload, btw. data cannot be stored in one single control field so i have to split it and concat it ... slow slow slow) or make the variables global (ugly!)
A memo field in a table might just solve all of these problems.
 
RuralGuy said:
I'm not quite sure what this means but I'm sure you are aware that Access is *not* multi-threaded so it can only do one thing at a time.

yes I'm quite aware and I don't want it to be MT...

If you don't mind me asking, why is the data in a string variable and not a memo field somewhere?

because it is a web input stream...

Thx for all the help, i figured out another method to do what I wanted.
 
Glad to here about your success with the issue. Thanks for posting back.
 

Users who are viewing this thread

Back
Top Bottom