Accessing and Displaying Field Description

Friday

Registered User.
Local time
Today, 18:23
Joined
Apr 11, 2003
Messages
542
I have an Access database that will used to collect data on numerous types of physical assets. Basically it's an audit. The questions posed during this audit are lengthy. So I put the question in the field description. Now I want to display this value in a text box when the user tabs into the field on the form. I've been pounding on this for two days with no luck. The record source for the form is a query. I already know the value shows up in the Status Bar, but I want it to display at the top of the form in bigger text. Has anyone done this before?
 
Friday,

Can't you just use the GotFocus event and:

Me.TopOfFormBigText = DLookUp(...)

Wayne
 
The only way I know of to get the description is through a TableDef. You could probably adapt this into a function that you passed table and field names and it gave back the description:

Code:
  Dim db            As DAO.Database
  Dim tdf           As DAO.TableDef
  Dim X             As Integer

  Set db = CurrentDb()
  Set tdf = db.TableDefs("TableName")

  For X = 0 To tdf.Fields.Count - 1
    Debug.Print tdf.Fields(X).Name & ": " & tdf.Fields(X).Properties("Description")
  Next X

  Set tdf = Nothing
  Set db = Nothing
 
Sorry Wayne, your post wasn't there when I started. I guess we made different assumptions about where the info is anyway. :D
 
Paul,

I think you're a lot closer to it than I was.

I'd use your code on the GotFocus event.

I knew I shoulda played golf today ... oh well.
Wayne
 
Who knows?

I should have played today too, though we have so much smoke here from fires in CA it probably wouldn't be healthy.
 
Obviously - I wouldn't recommend using the field's description property to store what truly is data. (It's not even meta data - is is part of the database, so maybe your structure could be a little different - at the very least you could employe a table of fieldnames and related questions).

As for the Description property, as Paul says, yep - it's there to be so grabbed.
Obviously checking for (or error handling against) it's existence. As the Description is an extended property which is only present if having been first explicitly created.
(This is done implicitly for you by Access if you enter the Description text through the table designer UI). But isn't there before that - so handle that eventuality.

Cheers.
 
Thanks for all your help:

LPurvis - My original thought was to build an additional table with the question text in it, and I will probably do that in the end. I just wanted to explore any other possibilities first.

Wayne and Paul - Thanks for the input. I'm still going to mess with this a bit, just 'cause I'm belligerent :D
 

Users who are viewing this thread

Back
Top Bottom