Naming reports created programatically

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • inglesp
    New Member
    • Jan 2008
    • 9

    Naming reports created programatically

    Hi all

    I'm creating a number of reports programatically , and I'd like to be able to name them sensibly. However, when I try something like
    Code:
     rptNew.Name = "something sensible"
    I just get told that "this property is read-only and can't be set".

    Am I trying to do something you can't do? Or am I just doing it wrong?

    Thanks in advance

    Peter.
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Originally posted by inglesp
    Hi all

    I'm creating a number of reports programatically , and I'd like to be able to name them sensibly. However, when I try something like
    Code:
     rptNew.Name = "something sensible"
    I just get told that "this property is read-only and can't be set".

    Am I trying to do something you can't do? Or am I just doing it wrong?

    Thanks in advance

    Peter.
    Peter,
    If the report exists, you can call the Rename() method of the DoCmd object. The syntax to use is:

    DoCmd.Rename(Ne wName, acReport, OldName)

    Remember that your report can't be open at the time you rename it, or you will get an error.

    Comment

    • inglesp
      New Member
      • Jan 2008
      • 9

      #3
      puppydogbuddy

      That's really helpful, thank you!

      Comment

      Working...