Hey.
I've got this little problem in my app which im trying to solve, but have no idea how...
I'm not even sure if i understand the problem but here goes:
I've got two forms, (let's call them Form1 and Form2).
On Form1, the user selects a customer from a database.
He then presses a button, which:
- Opens Form2
- Saves the customer name in a variable in Form2 (Form2.Cust_Name = ..)
Form2 now displays the customer name and some other emtpy fields, ready to be edited.
The user also has to choose an ID number.
For this I created a new form (frmID) which asks the user to enter the ID number, press OK and bring it to Form2. This is a modal form, which pops up as soon as the user presses the button to go to Form2.
This all works fine, except for one thing:
As soon as I display the 'sort of inputbox' (frmID), Form1 kicks into focus behind frmID.
I don't want this... I want Form2 to stay visible, and Form1 on the background.
I presume it's the way i coded it, which is something like the following:
Form1:
Form2:Code:Private Sub cmdGoToForm2_Click()
Form2.Show
'Copy variables to Form2
Form2.Cust_Name = txtCust_Name
Form2.txtCust_Name = Form2.Cust_Name
'Here some database show code to show the entrie of the selected Cust_Name
'Set Focus to Form2 explicitly and call the sub in Form2 which opens the frmID modal form
Form2.SetFocus
Call Form2.cmdNEW_Click
End Sub
The problem, i THINK, is that Form1 kicks back into focus when the "Call Form2.cmdNEW_Click" statement is made...Code:Public Sub cmdNEW_Click()
frmID.Show (vbModal)
End Sub
How can I stop this from happening? eg, call this sub without getting Form1 to the foreground (but still behind frmID, probably cause its a Modal form)..?
