473,419 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

Changing caption content in a Table or Form

Dear reader,

I can change the caption content of a field in a Form with the following VBA
code:

Rst!<FieldName>.Caption = "<NewCaptionContent>"

But if I do the same in a Table the following error message pops up:

"Method or data member not found"

Is there another VBA code available to do this in a Table or is it not
possible to change the Caption content with VBA in a Table?

Thanks for any help.

Kind regards,

Simon van Beek



Dec 4 '05 #1
1 2851
To add/change the caption property of a field in a table you do something
like this.
Sub AddFieldCaption(TabName As String, FldName As String, NewCaption As
String)
Dim loDB As DAO.Database
Dim loTab As DAO.TableDef
Dim loFld As DAO.Field
Dim loProp As DAO.Property

On Error GoTo AddFieldCaption_Error

Set loDB = CurrentDb
Set loTab = loDB.TableDefs(TabName)
Set loFld = loTab.Fields(FldName)
Set loProp = loFld.Properties("Caption")
loProp.Value = NewCaption
AddFieldCaption_Exit:
On Error Resume Next
Set loProp = Nothing
Set loFld = Nothing
Set loTab = Nothing
Set loDB = Nothing
On Error GoTo 0
Exit Sub

AddFieldCaption_Error:
Stop
Select Case Err
Case 3270
Set loProp = loFld.CreateProperty("Caption", dbText, NewCaption)
loFld.Properties.Append loProp
Case Else
' other error handling code here
End Select
Resume AddFieldCaption_Exit
End Sub

--
Terry Kreft

"S. van Beek" <S.******@HCCnet.nl> wrote in message
news:43*********************@textreader.nntp.hccne t.nl...
Dear reader,

I can change the caption content of a field in a Form with the following
VBA
code:

Rst!<FieldName>.Caption = "<NewCaptionContent>"

But if I do the same in a Table the following error message pops up:

"Method or data member not found"

Is there another VBA code available to do this in a Table or is it not
possible to change the Caption content with VBA in a Table?

Thanks for any help.

Kind regards,

Simon van Beek


Dec 4 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Tomek Toczyski | last post by:
What is the best way to attach a caption to an image in xhtml? I can attach a caption to a table by a "<caption>" tag but I would like to do sth similar to an image. How to do it in a natural...
32
by: deko | last post by:
I have a popup form with a textbox that is bound to a memo field. I've been warned about memo fields so I'm wondering if I should use this code. Is there any risk with changing the form's...
2
by: Casey Miller | last post by:
I have a site, http://www.onemorewebsite.com, that has a menu on the left side and a picture on the right side with a middle div for content in the middle. When I mouse over the menu, the picture...
1
by: mplus_2000 | last post by:
I have recently inherited a database. The switchboard (and other forms) displays the name of the database on it (top, center). Currently the name that appears is Reviews. There are plans to roll...
0
by: el_espasmo | last post by:
Yes... I know the question might be stupid but... I still want to try because I haven't been able to solve this. I have been trying to change some stuff in MySpace, but not in my profile, in...
1
by: Simon | last post by:
Dear reader, I am familiar with the possibility to change the Caption of a field in a form. But is there also a possibility to change the Caption of a field in the table structure it self.
11
by: Chris Beall | last post by:
See http://pages.prodigy.net/chris_beall/Demo/photo%20block%20experiments.html I've ended up with what seems like a rather complex structure for what I thought would be a somewhat simple...
9
by: Neal | last post by:
http://www.brassattackofspringfield.com/gigs.html CSS at http://www.brassattackofspringfield.com/default.css Opera and IE render caption as desired. Firefox does not. Why? And is there a fix?
2
by: stevenrec | last post by:
Hi, guess I am overlooking something, using a list, I change what info is displayed on a form that has 3 subforms. after selecting the topic to display, the subform names and links are read from...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.