Fill a "Caption" from a table (1 Viewer)

B

Bradparsons

Guest
I am trying to get the tabs on a Tab Control form to pull there titles (captions) from a table that stores information about a paticular job. This is what I have tried. It does display anything that is placed in the "", but it does not try to return the info from the Table

Private Sub Form_Open(Cancel As Integer)

Dim StrArea1 As String
Dim StrArea2 As String

StrArea1 = "[TableName].[FieldName]"

StrArea2 = "Sect_01_Info_Tbl.Client_Name"

Area1.Caption = StrArea1
Area2.Caption = StrArea2


End Sub

StrArea1 currently returns a tab with the title "[TableName].[FieldName]" .

Thanks
Bradp
 

doulostheou

Registered User.
Local time
Today, 04:13
Joined
Feb 8, 2002
Messages
314
I know how to do what you want from a form, so you may try creating a form to house the table. Simply add to your existing code:

Private Sub Form_Open(Cancel As Integer)

Dim StrArea1 As String
Dim StrArea2 As String

'Open a hidden copy of the form based off your table(you will need to set a criteria if there is more than one row in your table)
DoCmd.OpenForm "FormName",,,,,acHidden

StrArea1 = Forms!FormName!FieldName

'Close the hidden form
docmd.close acform, "FormName"

StrArea2 = "Sect_01_Info_Tbl.Client_Name"

Area1.Caption = StrArea1
Area2.Caption = StrArea2


End Sub

This should solve the problem.
 

Users who are viewing this thread

Top Bottom