Results 1 to 6 of 6
  1. #1
    DubCap01 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2014
    Location
    Dubbo, Australia
    Posts
    104

    Setting a constant caption for all forms

    Hi all gurus, and the great unwashed rest of you

    Just wondering if I can set each form's caption to reflect a value from a field in a table?



    TblCompany - one field [Companyname] which has the value of "Acme Coyote Dynamite Distributors"

    So, when each form opens up, the form's caption displays "Acme Coyote Dynamite Distributors" as opposed to the default crappy thing supplied by Mr Gates?

    I have no problem putting this into a function or on the Current event of the form, I'd just like some help with the VBA?

    thanks in anticipation RoadRunners!

    (my apologies for those too young to get the irony)

    Pete

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    In the form's load event ( or in current event if you want to change during data entry/navigation)
    Me.Caption="Your Caption"

  3. #3
    DubCap01 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Location
    Dubbo, Australia
    Posts
    104
    Hi Amnut

    I am aware of that one, what I would like is a function (called say "CaptionAcme") that I can add to every form

    So the function would be something like

    Function Public Acme()

    Me.caption = Dlookup("Companyname","TblCompany")

    End Function

    I just need the code to make the Dlookup work!

    cheers

  4. #4
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Public Function Acme() as String

    Acme = Dlookup("Companyname","TblCompany")

    End Function
    Me.Caption = Acme
    If there is only one line of code, Me.Caption is a better choice unless you need something more.

  5. #5
    DubCap01 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Location
    Dubbo, Australia
    Posts
    104
    Played it out exactly as you quoted, but the Form caption is still FrmMembers (name of the form)
    bedtime here, will check in the morning for more enlightening criticism - thanks Amrut

  6. #6
    DubCap01 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Location
    Dubbo, Australia
    Posts
    104
    Sorted, amrut,your code works perfectly, I was just too tired and created a typo! Solved thank you!

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

Similar Threads

  1. Replies: 1
    Last Post: 09-19-2014, 11:45 AM
  2. Replies: 6
    Last Post: 11-23-2013, 10:47 PM
  3. Replies: 3
    Last Post: 03-01-2013, 05:36 PM
  4. Access POPup forms - setting position
    By malcolm.wilcock@tesco.net in forum Forms
    Replies: 5
    Last Post: 02-24-2010, 10:56 AM
  5. tabular forms - setting values per each record
    By Daytona675 in forum Forms
    Replies: 0
    Last Post: 11-25-2008, 09:43 AM

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