TextBox Query

liam_conor

Board Regular
Joined
Oct 9, 2002
Messages
180
I can't figure this one out...

He is my situation. I have two forms that a user enters data into. One is the MainForm and the other is a SubForm. First the user enters his/her information in the MainForm and the clicks a command button that opens a SubForm. During the action a value is passed from the MainForm to the SubForm. (Statement Below)

Forms![frm_subvalue_waste_entry]![area_id] = Forms![frm_production_entry]![area_id]

This value is stored in the SubForm's area_id textbox. What I would like to do is use the value stored in area_id for a query. That query will return a value to another textbox productiontype_id. I cannot achieve this... Here is my query below:

SELECT
tbl_productiontype.productiontype_id
FROM
tbl_productiontype
WHERE
((tbl_productiontype.area_id)=Forms!frm_subvalue_waste_entry!area_id);

Can anyone help me??? Or does this not make any sense?
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
the syntax to get at a sub form is:
Forms!frmMainForm!subformName!fieldName
So, as I read your form names, it would be:
Forms!frm_production_entry!SubFormControlName.Form!area_id
Generally speaking, the SubFormControlName is the same name as the form that is being used as the subform. In your case that would be "frm_subvalue_waste_entry"
HTH
BTW, I would think you would be using area_id as the Child and Master linking fields for the subform.
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,457
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top