Since my field names for my tables and queries are not clear, I would like to get the field caption from the tables and queries through code so that I can put these on forms. Any ideas on how to do this?
From: Shamil Salakhetdinov <shamil@marta.darts.spb.ru>
To: ACCESS-L <ACCESS-L@PEACH.EASE.LSOFT.COM>
Subject: Re: How can I get the field caption property from code in Access97?
Date: 16 July 1998 19:02
Here is the function to solve the subject's task:
Function GetCaption(strTableName As String, strField As String) As Variant
on error resume next
GetCaption=dbengine(0)(0).TableDefs(strTableName).Fields(strField).Properties("caption")
End Function
HTH,
Shamil
P.S. Btw, here is an Acc 2.0 version of the function above:
Function GetCaption (strTableName As String, strField As String) As Variant
On Error Resume Next
Dim dbs As Database
Set dbs = dbengine(0)(0)
GetCaption = dbs.TableDefs(strTableName).Fields(strField).Properties("caption")
Set dbs = Nothing
End Function
| HOME TOPICS |
Copyright © 19981999 by Shamil Salakhetdinov.
|
| Last updated: October 10, 2006
Published also here at 4TOPS: Getting the field caption property from code in Access97 |
|