I have previously posted my question and didn't receive a helpful answer, spending a week looking at other resources...
Situation:
I have a form that inputs records to a database. When I want to put in information found in a supporting table, I use a Modal form to search the table (on SQL Server 7) and move the information found in the search results back to the original form. After querying the supporting table, I move the information from the grid of search results found to the fields the user inputs their search requirements to and when the Modal form is closed, it sends the foreign information to the fields it needs to go in.
Problem:
When I close the form, it should take information from the current form and move it back into the original form. As seen in the below code, I get a new instance of the form with the information I wanted in it instead of the instance of the form that originally called the saved within the record I am creating.
Private Sub cmdOk_Click()
'What do I do to pull the informatiion out the data grid?
'The following line of code makes the new instance of the form "frmNewRequest"
'one instance of form
frmNewRequest.txtDeveloperSSN = "102938838"
'two instances of form
'Closes Form... and opens a new request... don't want that...
Me.Hide
'Unload Me
End Sub
Question(s):
How do I reference different instances of the form?
How can I tell which instance is which?
How do I tell the form which instance I want filled in?
(I thought ActiveForm may be of use in the MDI but I must not know how to use it or it didn't like how I used it)
(Thanks in advance!)
(The only response I got
jjames (Programmer) Jul 18, 2001
You may want treat your forms like any other object...
In your calling (or parent form) add something like:
Private Sub Command1_Click()
Dim strSSN As String
Dim objNewRequest As MyForm
Set objNewRequest = New MyForm
objNewRequest.Text1 = "12345678" 'Initialize any data
for this instance of
the form
objNewRequest.Show vbModal
'If we've made it here then the OK button has
'been clicked or window was closed in instance of MyForm
'Get data from instance of MyForm
strSSN = objNewRequest.Text1
Set objNewRequest = Nothing 'destroy the instance
End Sub
In your query form, in this case MyForm, add the following:
Private Sub cmdOk_Click()
Me.Hide
End Sub
Of course you need to add a command button named 'cmdOk'
THE PROBLEM IS, that I don't WANT a new version of the form... I want to use the form that called the Modal Form. I want it to find what form opened it to do work and push back data into it. Any solutions? ****************
DariceLR
:-{} :-V
****************
Situation:
I have a form that inputs records to a database. When I want to put in information found in a supporting table, I use a Modal form to search the table (on SQL Server 7) and move the information found in the search results back to the original form. After querying the supporting table, I move the information from the grid of search results found to the fields the user inputs their search requirements to and when the Modal form is closed, it sends the foreign information to the fields it needs to go in.
Problem:
When I close the form, it should take information from the current form and move it back into the original form. As seen in the below code, I get a new instance of the form with the information I wanted in it instead of the instance of the form that originally called the saved within the record I am creating.
Private Sub cmdOk_Click()
'What do I do to pull the informatiion out the data grid?
'The following line of code makes the new instance of the form "frmNewRequest"
'one instance of form
frmNewRequest.txtDeveloperSSN = "102938838"
'two instances of form
'Closes Form... and opens a new request... don't want that...
Me.Hide
'Unload Me
End Sub
Question(s):
How do I reference different instances of the form?
How can I tell which instance is which?
How do I tell the form which instance I want filled in?
(I thought ActiveForm may be of use in the MDI but I must not know how to use it or it didn't like how I used it)
(Thanks in advance!)
(The only response I got
jjames (Programmer) Jul 18, 2001
You may want treat your forms like any other object...
In your calling (or parent form) add something like:
Private Sub Command1_Click()
Dim strSSN As String
Dim objNewRequest As MyForm
Set objNewRequest = New MyForm
objNewRequest.Text1 = "12345678" 'Initialize any data
for this instance of
the form
objNewRequest.Show vbModal
'If we've made it here then the OK button has
'been clicked or window was closed in instance of MyForm
'Get data from instance of MyForm
strSSN = objNewRequest.Text1
Set objNewRequest = Nothing 'destroy the instance
End Sub
In your query form, in this case MyForm, add the following:
Private Sub cmdOk_Click()
Me.Hide
End Sub
Of course you need to add a command button named 'cmdOk'
THE PROBLEM IS, that I don't WANT a new version of the form... I want to use the form that called the Modal Form. I want it to find what form opened it to do work and push back data into it. Any solutions? ****************
DariceLR
:-{} :-V
****************