J
Jen
I'we made a small simple sample database so that I could better explain my
problem.
I have one table, "tbl_main" that contains 2 columns 1:"id", 2:"name".
I also have 3 forms, 1:"frm_test", 2:"frm_pick", 3:"frm_big" .
The first form simply shows the names in at textbox and is bound to my table
"tbl_main" described earlier. On this form I also have a button opening my
second form "frm_pick".
My second form "frm_pick" is an unbound form with a textbox for writing in
data and a button that opens the first form "frm_test" filtered by that data
and finally closing the second form "frm_pick". The code behind this buttons
onclick event is:
Private Sub cmd_open_filtered_Click()
On Error GoTo Err_cmd_open_filtered_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_test"
stLinkCriteria = "[name]=" & "'" & Me![txt_name] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, Me.name
Exit_cmd_open_filtered_Click:
Exit Sub
Err_cmd_open_filtered_Click:
MsgBox Err.Description
Resume Exit_cmd_open_filtered_Click
frm.Visible = False
End Sub
Everything works ok so far.
In my third form, the unbound form "frm_big" I have a tab control "TabCtl0".
On the second tab (just because I have it like this on my real database in
where I have the problem) I have "frm_test" embedded as a subform. Now when
I click on this forms button that opens my second filtering form "frm_pick"
still everything is ok, the filtering form is opened. Here's my problem:
After writing in a value in the "frm_pick" and hitting the commandbutton
launching the code shown earlier, instead of showing the subform "frm_test"
filtered to whatever name I entered, "frm_test" opens as an own form,
filtered ok, leaving me with two "frm_test" open, the subform and a new
filtered one. I want the "frm_test" embedded as a subform in the tab control
being the one filtered and not have a seconf "frm_test" opened.
This I can't figure out how to do and would need help from you guys. Jen.
problem.
I have one table, "tbl_main" that contains 2 columns 1:"id", 2:"name".
I also have 3 forms, 1:"frm_test", 2:"frm_pick", 3:"frm_big" .
The first form simply shows the names in at textbox and is bound to my table
"tbl_main" described earlier. On this form I also have a button opening my
second form "frm_pick".
My second form "frm_pick" is an unbound form with a textbox for writing in
data and a button that opens the first form "frm_test" filtered by that data
and finally closing the second form "frm_pick". The code behind this buttons
onclick event is:
Private Sub cmd_open_filtered_Click()
On Error GoTo Err_cmd_open_filtered_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_test"
stLinkCriteria = "[name]=" & "'" & Me![txt_name] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, Me.name
Exit_cmd_open_filtered_Click:
Exit Sub
Err_cmd_open_filtered_Click:
MsgBox Err.Description
Resume Exit_cmd_open_filtered_Click
frm.Visible = False
End Sub
Everything works ok so far.
In my third form, the unbound form "frm_big" I have a tab control "TabCtl0".
On the second tab (just because I have it like this on my real database in
where I have the problem) I have "frm_test" embedded as a subform. Now when
I click on this forms button that opens my second filtering form "frm_pick"
still everything is ok, the filtering form is opened. Here's my problem:
After writing in a value in the "frm_pick" and hitting the commandbutton
launching the code shown earlier, instead of showing the subform "frm_test"
filtered to whatever name I entered, "frm_test" opens as an own form,
filtered ok, leaving me with two "frm_test" open, the subform and a new
filtered one. I want the "frm_test" embedded as a subform in the tab control
being the one filtered and not have a seconf "frm_test" opened.
This I can't figure out how to do and would need help from you guys. Jen.