ACC2000: Assigned Values Not Displayed When Form Opened As DialogID: Q210461
|
Moderate: Requires basic macro, coding, and interoperability skills.
When you use the OpenForm method or macro action to open a form
as a dialog form, fields on the form do not display the values
that you assign to them.
This occurs because dialog forms are modal, and Microsoft Access suspends code execution until the dialog form is closed. After the form is closed, you cannot set values for any of its controls.
Option Explicit
Function TestModal()
DoCmd.OpenForm "Form1", acNormal, "", "", acFormEdit, acDialog
Forms!Form1!Field0 = "Hello"
End Function
?TestModal()
Note that when the form opens, the text box does not display any text.
Also, when you close the form, you receive an error because the procedure continues to run, and the Field0 text box is no longer available to have its value set.
Additional query words: prb
Keywords : kbusage kbdta FmsEvnt
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: May 13, 1999