How to reference a Textbox by Query Criteria on a unbound Form displayed in Main Form ??? (1 Viewer)

corentin

New member
Local time
Today, 02:03
Joined
Jan 22, 2020
Messages
12
Hello everybody, Bom dia,

Let me explain my last problem on my project. I have a MainForm and other forms that are displayed on it with a subform view called "Form_View". Note that between MainForm and the other that I wantr to display, there are no links (Link Master Field and Link Chield Fields are empty).

The code to display it is the following :
Me.Form_View.SourceObject = "Stock_Management"

My problem is that a query doesn't refer to the TextBox field "SearchBar" in StockManagement Form when I display that form into my MainForm.
Is it needed to link the MainForm with that Form to get what I want ?

If not, could you help me please to refer it proprely. I display many forms in the MainForm in Order to get a better user experience.

Thank you in advance for your help.

Corentin
 

Attachments

  • 1583402090695.png
    1583402090695.png
    37.1 KB · Views: 106

Minty

AWF VIP
Local time
Today, 01:03
Joined
Jul 26, 2013
Messages
10,371
Book mark this page in your browser; The Form Reference Guide
So for your case, the syntax would I think (If I've understood your layout) be:

Forms!Mainform!Stock_Management.Form!SearchBar
 

corentin

New member
Local time
Today, 02:03
Joined
Jan 22, 2020
Messages
12
Book mark this page in your browser; The Form Reference Guide
So for your case, the syntax would I think (If I've understood your layout) be:

Forms!Mainform!Stock_Management.Form!SearchBar

Thanks a lot for your reply but it doesn't work. I have still the enter parameter input box that is displaying. "Stock_Management" and "Main_Form" Forms are not linked at all. When I put the infomation of the TextBox into the inputbox, the query works. I think the problem comes only from the reference ...
 

Minty

AWF VIP
Local time
Today, 01:03
Joined
Jul 26, 2013
Messages
10,371
Check you have the form and control names correct in your query reference. In your OP you called the main form MainForm - in your last post you called it Main_Form which would make this change;

Forms!Main_Form!Stock_Management.Form!SearchBar

Also you can use the expression builder to get the correct references in the query (The magic wand icon in the query design menu).
 

corentin

New member
Local time
Today, 02:03
Joined
Jan 22, 2020
Messages
12
Check you have the form and control names correct in your query reference. In your OP you called the main form MainForm - in your last post you called it Main_Form which would make this change;

Forms!Main_Form!Stock_Management.Form!SearchBar

Also you can use the expression builder to get the correct references in the query (The magic wand icon in the query design menu).

Ok I have found the problem : the correct syntax that I have found by the report dataCountrolSource is :

=[Forms]![Main_Form]![Form_View].[Form]![SearchBar]

Thanks a lot for helping me Minty, have a nice day !

Corentin
 

Minty

AWF VIP
Local time
Today, 01:03
Joined
Jul 26, 2013
Messages
10,371
You are welcome.

Personally before you get too far, I think I would rename Form_View to something a little less confusing maybe frmViewContainer or something similar?
Access calls certain events and objects Form_ so you may end up referencing Form_Form_View which is likely to get very awkward.
 

Users who are viewing this thread

Top Bottom