This cmdOpen is in Form1. My question is when I click on
cmdOpen, Form2 is open and then the msgbox pops up
right away. What I actually want is when I click on
cmdOpen, the Form2 is open, and only when I click
cmdCancel in Form2, the Form2 is close and then the code
msgbox is run. Can anyone give suggestion ?
NB: Should I just put the msgbox in the cmdCancel_Click instead ? That's what I have been doing.
Just like when I use common dialog control, for example :
Private Sub cmdOpen_Click()
Me.txtFileName = dlgCommon.FileName
It waits until I click on Save or Cancel, then continues
to the next code rather than assigning the value right
Read this code.
This event is to occur when cmdOpen is clicked.
The event to occur when cmdOpen is clicked is to open a form called Form2.
After opening the form, the next event is to pop up a message box with the letter A in it.
Now Access is finished. So form2 is open and displayed and a Messagebox with A is displayed as well, as this is what your code has told Access to do.
Is this what you want to happen?
Have a look at some basic programming books or on line courses. When I started to dabble in code I combined books like Access Bible with on line courses for visual basic, (Note: not Visual Basic for Applications). There is no substitute for training, no matter what your budget somewhere there is some training that at a minimum will get you started.