Question

Reference fields in a tab control

Asked by: cory_booth

Hello,

I have developed a TAB control with two forms inserted into each of these tabs.

The name of the page holding the Tab Control is: frmMAIN

The tab control is: TabCtl0

The subform of Page 1 is frmADD
The subform of Page 2 is frmEDIT

I have a textbox I want to manually insert values into on these pages.

How do I reference a textbox "txtUpdate" on "frmEDIT" which is a subform of
"frmMAIN" via a Tab Control "TabCtl0" on tab "Page 1"?





This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2004-12-20 at 16:47:40ID21249178
Tags

reference

,

tab

,

controls

Topic

Microsoft Access Database

Participating Experts
3
Points
500
Comments
19

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Refresh subform on different tab control
    Greetings, Experts...can somebody please help me resolve this? I have a form with 23 tabs, each with a subform linked to its own SQL table. Let's just deal with two for now (subfrm_00_MAIN and subfrm_01_TopDogHouse). Using the following code, I'm trying to refresh the Record_...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: eghtebasPosted on 2004-12-20 at 17:03:01ID: 12872216

What do you meant by reference?

txtUpdate is on subform frmEDIT and you enter a value/string in it.  Is this text box unbound?

Do you want the value enter to be coppied elsewhere?

mike

 

by: nico5038Posted on 2004-12-20 at 17:54:04ID: 12872458

The tab control isn't part of the reference as, like mike stated, the subform is seen as part of the mainform.
So it's like referencing directly from a main to a subform like:
me.subformname.form.fieldname
or in your case:
me.frmEdit.form.txtUpdate = "What you want"

Nic;o)

 

by: cory_boothPosted on 2004-12-20 at 18:34:55ID: 12872612

I will try an redo the code,

txtUpdate IS unbound - it is my field used to perform the Recordset Bookmark routine
as a search tool.

I am pulling a search item from several search routines I have imbedded into the
frmEDIT and placing the selected value into txtUPDATE to perform the Bookmark routine.

The form works perfectly when opend as a standalone form - but when I placed it into
a Tab subpage, I got errors of not being able to find the form.  So I instinctively thought it
was a Tab Control problem...

I will rework my code - as soon as my laptop is released from the hell of nickjr.com,
and if it still doesn't work - give you a sample of the code and the specific errors.

 

by: eghtebasPosted on 2004-12-20 at 18:45:12ID: 12872656

When you have the form runing by itself:

Me!txtUpdate      'if the code in form's code window of frmEDIT
Forms!frmEDIT!txtUpdate      ' if code is elsewhere and frmEDIT is running by itself

But, frmEDIT as a subform:

Forms!frmMAIN!frmEDIT.Form!txtUpdate
                           ^--- this here maybe same as form name itself or something different
                                  it is the name of control (it appears whith sometimes) and the name
                                  of the form (in this case frmEDIT) goes into this control's source
                                  object propert.

mike

 

by: cory_boothPosted on 2004-12-20 at 19:28:28ID: 12872839

OK,

I tried the later.  And I new I had used that line of code before...

Here is the error I get:
Run-Time error -2146500594
Method 'Item' of object 'Forms' failed

I used your code to the letter

frmEDIT is a subform within frmMAIN.
txtUpdate IS a unbound textbox on frmEDIT.
frmEDIT is in the first page ot a tab control.

 

by: eghtebasPosted on 2004-12-20 at 19:33:49ID: 12872866

What is the name of control that frmEDIT goes.  In its source object if should say frmEDIT,  I need its name.  Its name could be also frmEDIT or something else.

 

by: cory_boothPosted on 2004-12-20 at 19:39:14ID: 12872889

I'm not sure I understand what you mean by the control that frmEDIT goes.
Unless you mean the name of the Tab Control and then the Tab Name...
In which case,

The Tab Control is (for now) TabCtl0 (standard MS Access name)
and the Page or Tab name is "Edit"


 

by: eghtebasPosted on 2004-12-20 at 19:45:37ID: 12872913

In design view, select tab where frmEDIT is.  Now, there will be a rectangle (sometimes appears white) where frmEDIT is.

You need to select that control (usually, first click selects it and a second click selects form frmEDIT itself).  This control has a property calle "Source Object", it will be 2nd property from the top I think.  This property will read "frmEDIT", above that, there will be "Form-Container-Control" name.  That is what I am referring to.

mike

 

by: eghtebasPosted on 2004-12-20 at 19:54:39ID: 12872944

btw, don't look for "Form-Container-Control", I  should have had like form-container-control.  This what I am making up in order to say what you are looking for is a control that acts as container to a form.

 

by: eghtebasPosted on 2004-12-20 at 19:55:55ID: 12872950

This is what I am making up in order to say what you are looking for is a control that acts as container to a form.

 

by: cory_boothPosted on 2004-12-21 at 05:03:21ID: 12875279

Wow,

Why can't I seem to get this figured out???  :-)  Please bear with me...
I just can't find any other names that I haven't already provided.  Let me try to start from
scratch and explain all the names and see if it helps...

I made two forms - frmADD and frmEDIT.  Form edit has a unbound text box called txtUPDATE.
I use this text box to perform searches.  I pull search value from three other search routines
and plop their values into txtUPDATE then on the after update event of txtUPDATE I perform
the Bookmark routine to advance the form to the desired record.  

Each form works fine on it's own.  In frmEDIT I used Forms!FrmEDIT!txtUPDATE=searchvalue
to move the search value to the txt box.

Then I decided to put each form on a tab control so you can tab between adding and editing.

I created a form called frmMAIN

inserted a TAB Control and left it's name as tabctl0

The tab control made two pages or two tabs called Page 1 and Page 2.  I renamed each of those
to Add and Edit

Then I dragged and dropped frmEDIT to the Edit Page and frmADD to the Add Page.

Now my Forms!frmEDIT!txtUPDATE doesn't work.

I have looked all around these forms and their properties, but I can't seem to figure out what you need...  Sorry!  :-(

 

by: AJ_UKPosted on 2004-12-21 at 05:52:02ID: 12875619

Every sub-form sits inside a container--it is selectable in Design mode by clicking on the very edge of the subform while it resides in the main form (when it is selected, you will see the resize points on the whole sub-form).  Right-click on one of the resize points while the subform container is selected, and go to properties, and see what the property "Name" and "Source Object" values are, and report them here.

HTH,
AJ

 

by: cory_boothPosted on 2004-12-21 at 06:19:23ID: 12875815

OK,

Here tis:

For Subform Edit

Name: Edit
Source Object: frmEdit
Link Child: blank
Link Master blank
---snip---



 

by: nico5038Posted on 2004-12-21 at 06:28:22ID: 12875885

Hmm, "behind" the form it's best to refer to:
me.txtUPDATE
Thus a possible rename of the form won't effect the statement.
When you want to fill the field from code in the mainform you can use:
me.frmEdit.form.txtUPDATE
Just check the subformname in the properties "Other" tab when the subform is clicked in design mode only once.
When you did place the form twice, access will make a name up to be sure it's unique !

Nic;o)

 

by: cory_boothPosted on 2004-12-21 at 06:36:09ID: 12875950

OK,

Not sure if this helps - but it helped me!  :-)

Me.Parent.txtUPDATE = Value

I got this from the following:

Syntax for main/subforms

For these examples:
Mainform is the name of the top level form
Subform1 is the name of the subform CONTROL on mainform
Subform2 is the name of the subform CONTROL on the 1st subform.
           
    If you are on    
    Main form    Sub 1
To refer to a form property, like RecordSource        
On Mainform    Me.RecordSource    Me.Parent.RecordSource
On Sub 1    Me!Subform1.Form.RecordSource    Me.RecordSource
On Sub 2    Me!Subform1.Form!Subform2.Form.
RecordSource    Me!Subform2.Form.RecordSource
To refer to a control        
On Mainform    Me!ControlName    Me.Parent!ControlName
On Sub 1    Me!Subform1.Form!ControlName    Me!ControlName
On Sub 2    Me!Subform1.Form!Subform2.Form!
ControlName    Me!Subform2.Form!ControlName
To refer to a control property, like Enabled        
On Mainform    Me!ControlName.Enabled    Me.Parent!ControlName.Enabled
On Sub 1    Me!Subform1.Form!ControlName.Enabled    Me!ControlName.Enabled
On Sub 2    Me!Subform1.Form!Subform2.Form!
ControlName.Enabled    Me!Subform2.Form!ControlName.Enabled
To refer to a subform control property, like SourceObject        
On Mainform    N/A    N/A
On Sub 1    Me!Subform1.SourceObject    N/A
On Sub 2    Me!Subform1.Form!Subform2.SourceObject    Me!Subform2.SourceObject
       
    If you are on    
    Sub2    Not in these forms
To refer to a form property, like RecordSource        
On Mainform    Me.Parent.Parent.RecordSource    Forms!Mainform.RecordSource
On Sub 1    Me.Parent.RecordSource    Forms!Mainform!Subform1.Form.RecordSource
On Sub 2    Me.RecordSource    Forms!Mainform!Subform1.Form!Subform2.
Form.RecordSource
To refer to a control        
On Mainform    Me.Parent.Parent!ControlName    Forms!Mainform!ControlName
On Sub 1    Me.Parent!ControlName    Forms!Mainform!Subform1.Form!ControlName
On Sub 2    Me!ControlName    Forms!Mainform!Subform1.Form!Subform2.
Form!ControlName
To refer to a control property, like Enabled        
On Mainform    Me.Parent.Parent!ControlName.Enabled    Forms!Mainform!ControlName.Enabled
On Sub 1    Me.Parent!ControlName.Enabled    Forms!Mainform!Subform1.Form!ControlName.Enabled
On Sub 2    Me!ControlName.Enabled    Forms!Mainform!Subform1.Form!Subform2.
Form!ControlName.Enabled
To refer to a subform control property, like SourceObject        
On Mainform    N/A    N/A
On Sub 1    N/A    Forms!Mainform!Subform1.SourceObject
On Sub 2    N/A    Forms!Mainform!Subform1.Form!Subform2.
SourceObject

 

by: cory_boothPosted on 2004-12-21 at 06:40:39ID: 12875988

So to help with all of this...

In the end - If I wanted to do the same above - but use the [Forms]![frmEDIT]! routine...   How would,
Me.Parent.txtUPDATE look if it is called from a subfrom of frmEDIT which is a subform of frmMAIN?

Just so I understand.... :-)

 

by: nico5038Posted on 2004-12-21 at 07:02:30ID: 12876174

The Me refers to the active form, used as sub or "standalone"
When you want to "push" a value from the subform to the main form you can use:
Parent.txtUpdate = me.txtUpdate
Or when on a sub/sub form use Parent.Parent.txtUpdate to push up two levels.

From your question it looked like you wanted to fill a subform field from a field on the mainform.

Nic;o)

 

by: cory_boothPosted on 2004-12-21 at 07:37:20ID: 12876479

OK,

So because I was working from a subform and not the main form the [Forms]![frmMAIN]![frmEDIT].[Form]![txtUPDATE] would not
work?

I figured it WOULD work no matter what - if you simply got the code right....

I always thought - Me.Parent was just another way of stating [Forms]![subform]! without having to specifically identify the exact
forms and names.

thanks for all your help though!

 

by: nico5038Posted on 2004-12-21 at 07:45:56ID: 12876548

Parent is a reference to a Parent form and will only work when the form is placed on another form, otherwise an error message will be issued.
That's also the reason why I name my subforms with a prefix "sfrm", making clear they might not work when opened directly from the editor.
The "[Forms]![frmMAIN]![frmEDIT].[Form]![txtUPDATE]" will work when the frmEdit is placed on frmMain, but not when the subform is opened "standalone" and when it's all "within" the form using "Me.txtUpdate" would have the same effect, but will also work when you place the frmEdit on another form or when you would use it "stand-alone"

Has the problem been solved now ?

Nic;o)

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...