Query parameter is field on subform?

J

Judy Ward

This is what I have that works:
txtAssignee on frmMain
qrySARs_By_Assignee with this Criteria for SAR_Assignees:
Like "*" & [Forms]![frmMain]![txtAssignee] & "*"

Now I want to use a Tab Control on frmMain, I dragged a form onto one of the
tabs, which makes it a subform (right?). I double-checked the name of this
subform--it is frmTabA--and it has the field txtAssignee. I changed the
Criteria for SAR_Assignees in qrySARs_By_Assignee to:
Like "*" & [Forms]![frmMain]![frmTabA].[Form]![txtAssignee] & "*"

This does not work. When I click the button to open the form that uses this
query as it's source I get a pop-up, "Enter Parameter Value
Forms!frmMain!frmTabA.Form!txtAssignee". I must not be referencing the text
box correctly. Can someone help me out with this?

Thank you,
Judy
 
O

Ofer

Sorry for askng this questions, but just to make sure
1. When you open the second form, does the first form is already open?
2. The frmTabA need to be the name of the frame of the sub form in the main
form, and not the actual name of the subform.
3. The thing that made me puzeled
[Forms]![frmMain]![txtAssignee]
[Forms]![frmMain]![frmTabA].[Form]![txtAssignee]

The first one worked, the second one not.
You said that you made the frmMain, from the first example, into a subform,
so how come the main form still called frmMain, mybe the main form has a
different name?
 
J

Judy Ward

I renamed my original frmMain and created a new one with the Tab Control.
I created a form named frmForms (because it opens forms) and dragged this
onto a tab. I named it frmTabA as the subform. I read up on how to refer to
fields on a subform--can't figure out why this is not working.

Ofer said:
Sorry for askng this questions, but just to make sure
1. When you open the second form, does the first form is already open?
2. The frmTabA need to be the name of the frame of the sub form in the main
form, and not the actual name of the subform.
3. The thing that made me puzeled
[Forms]![frmMain]![txtAssignee]
[Forms]![frmMain]![frmTabA].[Form]![txtAssignee]

The first one worked, the second one not.
You said that you made the frmMain, from the first example, into a subform,
so how come the main form still called frmMain, mybe the main form has a
different name?

--
I hope that helped
Good luck


Judy Ward said:
This is what I have that works:
txtAssignee on frmMain
qrySARs_By_Assignee with this Criteria for SAR_Assignees:
Like "*" & [Forms]![frmMain]![txtAssignee] & "*"

Now I want to use a Tab Control on frmMain, I dragged a form onto one of the
tabs, which makes it a subform (right?). I double-checked the name of this
subform--it is frmTabA--and it has the field txtAssignee. I changed the
Criteria for SAR_Assignees in qrySARs_By_Assignee to:
Like "*" & [Forms]![frmMain]![frmTabA].[Form]![txtAssignee] & "*"

This does not work. When I click the button to open the form that uses this
query as it's source I get a pop-up, "Enter Parameter Value
Forms!frmMain!frmTabA.Form!txtAssignee". I must not be referencing the text
box correctly. Can someone help me out with this?

Thank you,
Judy
 
O

Ofer

When the form is running, open the immidiate window (Ctrl+G) type
?Forms!frmMain!frmTabA.Form!txtAssignee

And see if it return a value or gives an error

If that works fine, can you post the SQL?
--
I hope that helped
Good luck


Judy Ward said:
I renamed my original frmMain and created a new one with the Tab Control.
I created a form named frmForms (because it opens forms) and dragged this
onto a tab. I named it frmTabA as the subform. I read up on how to refer to
fields on a subform--can't figure out why this is not working.

Ofer said:
Sorry for askng this questions, but just to make sure
1. When you open the second form, does the first form is already open?
2. The frmTabA need to be the name of the frame of the sub form in the main
form, and not the actual name of the subform.
3. The thing that made me puzeled
[Forms]![frmMain]![txtAssignee]
[Forms]![frmMain]![frmTabA].[Form]![txtAssignee]

The first one worked, the second one not.
You said that you made the frmMain, from the first example, into a subform,
so how come the main form still called frmMain, mybe the main form has a
different name?

--
I hope that helped
Good luck


Judy Ward said:
This is what I have that works:
txtAssignee on frmMain
qrySARs_By_Assignee with this Criteria for SAR_Assignees:
Like "*" & [Forms]![frmMain]![txtAssignee] & "*"

Now I want to use a Tab Control on frmMain, I dragged a form onto one of the
tabs, which makes it a subform (right?). I double-checked the name of this
subform--it is frmTabA--and it has the field txtAssignee. I changed the
Criteria for SAR_Assignees in qrySARs_By_Assignee to:
Like "*" & [Forms]![frmMain]![frmTabA].[Form]![txtAssignee] & "*"

This does not work. When I click the button to open the form that uses this
query as it's source I get a pop-up, "Enter Parameter Value
Forms!frmMain!frmTabA.Form!txtAssignee". I must not be referencing the text
box correctly. Can someone help me out with this?

Thank you,
Judy
 
J

Judy Ward

I did as you suggested with the Immediate Window and got this pop-up:
Run-time error '438': Object doesn't support this property or method.

Here is the SQL:
SELECT tblSAR.SAR_Link, tblSAR.SAR_ID, tblSAR.SAR_Title, tblSAR.SAR_Element,
tblSAR.SAR_State, tblSAR.SAR_Originator, tblSAR.SAR_Assignees,
tblSAR.SAR_Multipurpose
FROM tblSAR
WHERE (((tblSAR.SAR_State)<>"CLOSED_AS_REJECTED") AND
((tblSAR.SAR_Assignees) Like "*" &
[Forms]![frmMain]![frmTabA].[Form]![txtAssignee] & "*"))
ORDER BY tblSAR.SAR_ID, tblSAR.SAR_Element;

I honestly have no idea what the problem is. I'm still using my old frmMain
in the "production" db, and am testing the Tab Control on the side. I was
really looking forward to the new look. If you have any ideas I would love
to hear them.

Thank you for your help,
Judy

Ofer said:
When the form is running, open the immidiate window (Ctrl+G) type
?Forms!frmMain!frmTabA.Form!txtAssignee

And see if it return a value or gives an error

If that works fine, can you post the SQL?
--
I hope that helped
Good luck


Judy Ward said:
I renamed my original frmMain and created a new one with the Tab Control.
I created a form named frmForms (because it opens forms) and dragged this
onto a tab. I named it frmTabA as the subform. I read up on how to refer to
fields on a subform--can't figure out why this is not working.

Ofer said:
Sorry for askng this questions, but just to make sure
1. When you open the second form, does the first form is already open?
2. The frmTabA need to be the name of the frame of the sub form in the main
form, and not the actual name of the subform.
3. The thing that made me puzeled
[Forms]![frmMain]![txtAssignee]
[Forms]![frmMain]![frmTabA].[Form]![txtAssignee]

The first one worked, the second one not.
You said that you made the frmMain, from the first example, into a subform,
so how come the main form still called frmMain, mybe the main form has a
different name?

--
I hope that helped
Good luck


:

This is what I have that works:
txtAssignee on frmMain
qrySARs_By_Assignee with this Criteria for SAR_Assignees:
Like "*" & [Forms]![frmMain]![txtAssignee] & "*"

Now I want to use a Tab Control on frmMain, I dragged a form onto one of the
tabs, which makes it a subform (right?). I double-checked the name of this
subform--it is frmTabA--and it has the field txtAssignee. I changed the
Criteria for SAR_Assignees in qrySARs_By_Assignee to:
Like "*" & [Forms]![frmMain]![frmTabA].[Form]![txtAssignee] & "*"

This does not work. When I click the button to open the form that uses this
query as it's source I get a pop-up, "Enter Parameter Value
Forms!frmMain!frmTabA.Form!txtAssignee". I must not be referencing the text
box correctly. Can someone help me out with this?

Thank you,
Judy
 
Top