How to programmatically Change a format in a report?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ralph Murgia

    #1

    How to programmatically Change a format in a report?

    I tried Format([PeriodDate],"mm yyyy") in a query and it worked. When I put the same code beginning with an equals sign in the Control Source field of the report I got #Error. The ultimate goal is to programmaticall y use the following code:
    TextBox.Control Source = "Format([PeriodDate],""mm yyyy"")", however, I cannot get it to work when I manually enter it. Any ideas?
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    The general way is to set the Format property under the Format tab to "mm yyyy" (without quotes!) and to bind the control to a date field.
    Why would you want to do this from code?

    Nic;o)

    Comment

    • Ralph Murgia

      #3
      Thanks for the response. I was able to set the format programmaticall y with: TextBox.Format = "mm yyyy"
      after creating the report with: CreateReportCon trol

      Comment

      Working...