Field Label as a Formula

Posted on 2008-11-05
Last Modified: 2008-11-12

I want to be able to set a field label name through a formula. So far this is what i have

Format(now(),"mm-yyyy": "test"

But apparently the field label still shows up as Format(now(),"mm-yyyy" and not 11-2008: "test"

any suggestions?
Question by:repco
    LVL 61

    Accepted Solution

    Try adding this code to the open event of your form (replace myLabelName with the actual label name):

    Me.MyLabelname.Caption = Format(now(),"mm-yyyy") &  " test"

    Author Comment

    well i have this in a SQL query and not in a form. sorry i should of mentioned that
    LVL 77

    Assisted Solution

    You can't assign values to labels in sql.
    You have to use vba code.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    In the previous article, Using a Critera Form to Filter Records (, the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
    In the article entitled Working with Objects – Part 1 (, you learned the basics of working with objects, properties, methods, and events. In Work…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now