none
Add controls to form with VBA RRS feed

  • Question

  • Thank you for taking the time to read my question.

    Is it possible to add a text box to a form while it is in use or do I need to make the text box invisible then when needed make it visible?

    I found this: https://docs.microsoft.com/en-us/office/vba/api/access.application.createcontrol#example

    however the form needs to be in design or layout view.

    I want the user to click a button to add a new text box.

    Thanks,

    Monday, February 25, 2019 9:17 PM

Answers

  • You cannot add controls to a form while it is in form view. So it's best to add the controls in advance and set their Visible property to False. When you need them, set their Visible property to True, and if necessary, position them correctly by setting their Top and Left properties.

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by mbrad Monday, February 25, 2019 10:30 PM
    Monday, February 25, 2019 9:23 PM

All replies

  • You cannot add controls to a form while it is in form view. So it's best to add the controls in advance and set their Visible property to False. When you need them, set their Visible property to True, and if necessary, position them correctly by setting their Top and Left properties.

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by mbrad Monday, February 25, 2019 10:30 PM
    Monday, February 25, 2019 9:23 PM
  • Thank you for the quick reply Hans.

    have a great day!

    Monday, February 25, 2019 10:30 PM