Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 29th, 2006, 08:18 PM
Authorized User
 
Join Date: Oct 2006
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default Referencing Fields within Tab Control Pages -Help

I cannot set the reference to a textbox object that exists in a subform that is in a page on a TabControl.

Before I introduced the TabControl I would set the references thru the mainform as follows:

Public Sub COT1_AfterUpdate()

Dim txtTPC As TextBox
Dim txtPC As TextBox
Dim txtCOT As TextBox

Set txtCOT = Forms!frmMainOrderBatchs.sfmOrderArray!COT1
Set txtPC = Forms!frmMainOrderBatchs.sfmOrderArray!PC1
Set txtTPC = Forms!frmMainOrderBatchs.sfmTruckingArray!TPC1

End Sub

The above event is triggered from the sfmOrderArray.COT1 field. The 3rd line references a different subform on the mainform. The syntax works

Now that I have created a TabControl on the MainForm, and moved the subforms onto Page1 of the TabControl, I got the first 2 lines to work (cheating by using the Me keyword as syntax) as follows:

Set txtPC = Me.TP1
Set txtCOT = Me.P1

Notice above I didn't figure out how to reference them implicitly, I would like to know how to do that.

But I could never get the 3rd reference to set. the 'Me' keyword obviously won't do because the field I am trying to set is on a different subform on the same page. What is the proper syntax for that?

Set txtTPC = Forms!frmMainOrderBatchs!Pages!Page1!Forms!sfmTruc kingArray!.T1

(That doesn't work! I have tried too many ways and cant get it)

Help!! I would be most grateful.
 
Old October 30th, 2006, 01:31 PM
Authorized User
 
Join Date: Oct 2006
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well ... It turns out that I had renamed the form from sfT1 to sfTruck1 in the database container, but it retained the sfT1 name in the properties box and I didn't notice it.

As it turns out I can ignore the 'Tabs/Pages' part altogether and refer to it as:

Forms!fOD.sfT1!tPC1

Or, using my first post form names it would be just as I had it listed:

Set txtTPC = Forms!frmMainOrderBatchs.sfmTruckingArray!TPC1












Similar Threads
Thread Thread Starter Forum Replies Last Post
How to disable a tab on a tab control. dbradley VB.NET 6 April 14th, 2011 10:04 AM
Referencing Fields using VBScript in Outlook 2000 stelhead All Other Wrox Books 0 January 3rd, 2008 12:04 PM
Referencing Unbound fields with variables TomW Access VBA 2 November 12th, 2006 11:55 AM
Referencing a user control properties trekmp General .NET 2 April 7th, 2004 08:40 AM
Problem using AppendText with Tab pages sis C# 3 February 16th, 2004 05:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.