Results 1 to 10 of 10
  1. #1
    Star Lounger
    Join Date
    Sep 2009
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    I’m creating a database that will allow users to select various options and then select a template they wish to generate in Word. Depending on the template they choose, I want to display additional options for them to fill values in to. These options will change depending on the template they choose.

    I'm trying to create a dynamic form which will allow the user to select what options they chose from the main screen, but also present the additional options I want them to fill out on a 'pop-up' (dynamic) form. Based on the options they chose on the main screen along with the additional options they fill out on the pop-up form, this will allow them to generate their template.

    I don’t want to save the pop-form I present to the user. I just want to use this as a way for the user to review what they previously filled in and also add additional data before they generate the template.

    I can create the form ok and create labels etc which shows the options they’ve chosen. I can also create text boxes etc for them to fill out additional data. I’m also creating a button which the user will click, at which point I’m then trying to call another routine which will actually generate the letter in Word. Basically I need to set the ‘On Click’ event of this button to call the routine. I’ve tried just setting the ‘On Click’ property of the button to call the routine directly - Eg, =GenerateLetters(), but I receive an error when I do this. I think I need to set an ‘event procedure’ on the button once it’s created, but not sure if I’m able to do this since the form itself isn’t saved. Is this possible? Is there another/better way to do this?

    Cheers,

  2. #2
    Lounger
    Join Date
    Jun 2010
    Location
    Manchester, NH
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think a better way for you to approach this would be to examine your reasoning for not creating a persistant form and showing, hiding and populating controls etc as needed. Creating a form "On the fly" in design view seems to me to be frought with potential disaster.

    Is there a reason you are not creating a persistant form?

    Bob Oxford
    Bob Oxford
    Software Wizards, Inc.

  3. #3
    Star Lounger
    Join Date
    Sep 2009
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi bob,

    I thought about this, but one of the reasons I thought about not doing this was that depending on where teh controls were created on the form in the first place, they would appear in different spots as others were hidden or unhidden. (Eg, one control might appear at the top of the form while another might in the bottom right.

    Is there a way around this?

    Cheers,
    Jason

  4. #4
    Lounger
    Join Date
    Jun 2010
    Location
    Manchester, NH
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sure...

    One way is to set up a Tab Control with a different page for each situation. Put the controls in places that you want them and then just choose the desired page of the tab depending on the scenario.

    Another way is to move the controls around on the form by setting the Left and Top Properties as needed.

    Also, Controls can overlay each other in design view and you can just set the Visible property of each control depending on the situation. Lots of ways to work this out.

    Hope that helps.

    Bob Oxford
    Bob Oxford
    Software Wizards, Inc.

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Quote Originally Posted by Bob Oxford View Post
    One way is to set up a Tab Control with a different page for each situation. Put the controls in places that you want them and then just choose the desired page of the tab depending on the scenario.
    I agree with the idea of just showing/hiding the controls according to the situation, but I believe (from previous threads) that there actually 100 situations. A Tab control with 100 pages would be a nightmare to manage.

    Could the 100 (or so) situations be grouped into Categories, so that users first choose a Category, then make a specific choice from within that Category.
    Regards
    John



  6. #6
    Star Lounger
    Join Date
    Sep 2009
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Another way is to move the controls around on the form by setting the Left and Top Properties as needed.
    Hi Bob,

    Am I able to do this 'dynamically'? By that I mean, without putting the form into design view, moving the fields around and then redisplaying the form?

    Cheers,
    Jason

  7. #7
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Yes you can move controls via code without switching to Design view.
    Regards
    John



  8. #8
    Star Lounger
    Join Date
    Sep 2009
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes you can move controls via code without switching to Design view.
    Hi John,

    Are you able to point me in the right direction for this as far as code goes? I'm actually thinking of using this for another question I just posted about whether to use 2 tables for 'individuals' and 'corporations'. For example, if a user wishes to create a new 'client', I currently have a drop down box which lets them select 'individual' or 'client'. Depending on what they choose, I want to unhide and hide and also move controls around dynamically.

    cheers,
    Jason

  9. #9
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    The attachment has some code that moves controls around and hides/shows them in the after update event.
    The Unit used for the Left and Top Properties is the TWIP. There are 567 twips in a cm and (Ithink) 1440 in an inch, so you need big numbers.
    [attachment=90281:Controls.zip]
    Attached Files Attached Files
    Regards
    John



  10. #10
    Star Lounger
    Join Date
    Sep 2009
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for all the help guys, much appreciated!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •