Results 1 to 7 of 7
  1. #1
    newbieX is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    111

    Accessing datasheet captions

    For some reason the text from the associated table's field description auto-populated the datasheet caption property on one of my forms instead of the status bar text property. I want programmatically update the status bar text with this value. I am not sure how to reference the datasheet caption in design mode and run the following code:

    Suggestions?

    Code:
    Dim ctl As Control
    
    For Each ctl In [Forms]![frmInventory].Controls
        Select Case ctl.ControlType
            Case acCommandButton, acCheckBox, acTextBox, acListBox, acComboBox, acToggleButton
            ctl.StatusBarText = ctl.Properties("DataSheetCaption")
        End Select
    Next
    Anybody have any idea how the datasheet caption got the description info instead of the status bar text? Could it be because the form was created by copying and pasting from another form? (I did not initially design the form. I am just trying to fancy it up)

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    What would be the point?...the status bar can only hold 1 text, yet you have it changing for every control on the screen.
    This wont accomplish anything except show the last control.

  3. #3
    newbieX is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    111
    If I run this code in design view and then save it, the changes are permanent. I do not want the description text for each of my controls in the Datasheet caption property (which for some odd reason is where it is at) but the status bar text property. I am trying to change these values programmatically rather than one by one in the design view.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I am also baffled. What is the reason for all this? Related thread https://www.accessforums.net/program...rms-47388.html

    Since when do controls have StatusBarText property anyway? Isn't the StatusBar an application feature?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    newbieX is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    111
    Quote Originally Posted by June7 View Post
    I am also baffled. What is the reason for all this? Related thread https://www.accessforums.net/program...rms-47388.html

    Since when do controls have StatusBarText property anyway? Isn't the StatusBar an application feature?
    New at this so maybe I am getting syntax wrong. When I open a form in design view and click on a control, say a textbox that is bound to a field in an sql query that is pulling records from several tables and I go to the 'Other" tab in the properties sheet, I see several properties. The properties I am trying to manipulate (because they either weren't populated, or were populated wrong) are Datasheet Caption and Status Bar Text. I am trying to populate the Status Bar Text property for these controls with its associated description found in the table's design view. In the example above, all the field's descriptions are written to the Datasheet Caption property rather than the Status Bar Text property. I am trying to grab the information in the Datasheet Caption property and put it in the Status Bar Text property. I want the changes to be permanent so I am running all this from the form's design view and then saving the changes.

    The above code works for other properties (such as ControlTip text) but not for the Datasheet Caption (which, BTW, is only visible in the properties sheet in design view). If I wanted to copy the ControlTipText property text to the Status Bar Text property I could substitute the following code:

    Code:
    ctl.StatusBarText = ctl.Properties("DataSheetCaption")
    to:

    Code:
    ctl.StatusBarText = ctl.ControlTipText
    and it would work. For some reason it is not recognizing the DataSheetCaption property.

    For the thread referenced above, I also have an unbound form that already has the status bar text property populated and another form that is exactly the same except it is bound and does not have the status bar text property filled out. It is blank. I wanted to compare the two forms controls (by their names which are identical) and when there was a match, to I want copy the values from the unbound form status bar text property to the bound form's status bar text property.

    Does this help clear things up? I know I can do all this manually but am trying to see what I can and cannot do using VBA and hopefully learning a few things along the way.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Okay, understanding a little. Whatever is in the control StatusBarText property should display in the application Status Bar when the control has focus. I've never bothered with this property.

    So you want to set each control StatusBarText property with the caption for the associated field in table then save the modified form? Pulling caption from table because labels associated with the data controls do not have the caption?

    I have no idea how to pull the caption from the table. Probably lot more complicated code using TableDefs.

    How many controls need this edit? With all the time spent trying to code this could probably have the manual edits done.

    Was the other thread resolved?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    newbieX is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    111
    Already has taken longer. I was just trying to learn VBA (the hard way apparently. LOL). You're right though, it is going to take way too long to figure this one out. Maybe some other time when I've got days to kill. Ran into a snag on other thread which you can follow over there if so inclined. Thanks. I've come to recognize your name. Heck with all the help you've given me lately, I'd be inclined to name my next born child after you but I'm way past the ability (or inclination) to be birthin' babies.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 03-04-2014, 12:35 PM
  2. Custom button captions msgbox
    By Ruegen in forum Access
    Replies: 2
    Last Post: 11-20-2013, 03:59 PM
  3. Making two label captions the same
    By thebionicredneck2003 in forum Forms
    Replies: 10
    Last Post: 05-10-2013, 01:54 PM
  4. Using table data as button captions
    By jecanne in forum Access
    Replies: 7
    Last Post: 11-13-2011, 04:56 PM
  5. Form with Label captions that size dynamically
    By karmacable in forum Forms
    Replies: 3
    Last Post: 09-26-2011, 10:09 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums