Hi,
I'm writing a program using VBA 2003, I have a Form called "Form1" that has 1 "txtName" TextBox and 1 "btnOpen" CommandButton.
I would like that, when the user clicks on "btnOpen", another modal form (called "Form2") opens, where the user can insert a text in a "txtNameInsert" TextBox and then click on a "btnOk" CommandButton or "btnCancel" CommandButton.
If the user clicks on "btnOk", the text of "Form2.txtNameInsert" should be copied into "Form1.txtName" (and then "Form2" closes automatically), and if he clicks on "btnCancel", no text should be copied from one TextBox to another (and then "Form2" closes automatically).
In Form1 I prepared the event handler:
Private Sub btnOpen_Click()
DoCmd.OpenForm "Form2" 'Form2 already set in modal mode
End Sub
In Form2 I prepared the variables:
Public blnOk As Boolean
Public blnCancel As Boolean
and the event handlers:
Private Sub btnOk_Click()
blnOk = True
End Sub
Private Sub btnCancel_Click()
blnCancel = True
End Sub
Using this code, how can I obtain what I want? (in other words, I would like to obtain a custom dialog form where in the main window I can understand if the user has clicked on btnOk or btnCancel, and what he has written in the inner of the form...)
Thanks for the help
I'm writing a program using VBA 2003, I have a Form called "Form1" that has 1 "txtName" TextBox and 1 "btnOpen" CommandButton.
I would like that, when the user clicks on "btnOpen", another modal form (called "Form2") opens, where the user can insert a text in a "txtNameInsert" TextBox and then click on a "btnOk" CommandButton or "btnCancel" CommandButton.
If the user clicks on "btnOk", the text of "Form2.txtNameInsert" should be copied into "Form1.txtName" (and then "Form2" closes automatically), and if he clicks on "btnCancel", no text should be copied from one TextBox to another (and then "Form2" closes automatically).
In Form1 I prepared the event handler:
Private Sub btnOpen_Click()
DoCmd.OpenForm "Form2" 'Form2 already set in modal mode
End Sub
In Form2 I prepared the variables:
Public blnOk As Boolean
Public blnCancel As Boolean
and the event handlers:
Private Sub btnOk_Click()
blnOk = True
End Sub
Private Sub btnCancel_Click()
blnCancel = True
End Sub
Using this code, how can I obtain what I want? (in other words, I would like to obtain a custom dialog form where in the main window I can understand if the user has clicked on btnOk or btnCancel, and what he has written in the inner of the form...)
Thanks for the help