Results 1 to 9 of 9
  1. #1
    New Lounger
    Join Date
    Jun 2006
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default values in form based on Combo Box (2003)

    I created a form which displays a record based on the value of a combo box (using the wizard). When I open the form, the combo box is blank, but the first record's data is displayed in the text boxes on the form. How can I set my form to display blank fields, rather than display the first record, when the form is first opened?

    Thanks much!

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Default values in form based on Combo Box (200

    The only way it could show blank fields would be if it were at a new record, and you probably don't want that. People would create new records by mistake.

    I set the visible property of the Detail section of the form to be false so you don't see the first record, then change it to true when I choose a value in the combobox.

    Me.Section("Detail").Visible = True
    Regards
    John



  3. #3
    New Lounger
    Join Date
    Jun 2006
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Default values in form based on Combo Box (200

    Thanks for the idea; the problem is that the combo box is in the Detail section, so it starts out as invisible when the form opens.

    Do you think it would be worthwhile to have all of the other controls set to invisible, but then changed to visible when the combo box updates? If so, is there a way to set that to happen only after the first time a record is chosen in the combo box, so that I don't have extra code running every time the combo box changes?

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Default values in form based on Combo Box (200

    Can you just move the combo box to the form header?
    Regards
    John



  5. #5
    New Lounger
    Join Date
    Jun 2006
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Default values in form based on Combo Box (200

    Did that. However, the form is a Pop-up, and since the Detail section is set as not visible, when the form opens, only the Form Header is displayed, even after a record is chosen from the combo box. how can I set it that the form resizes to display the Detail Section after updating the combo box?

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Default values in form based on Combo Box (200

    Perhaps you'd be better off either accepting that the text boxes will not be blank when the form is opened (I don't understand what your objection is), or placing the combo box on a different form.

  7. #7
    New Lounger
    Join Date
    Jun 2006
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Default values in form based on Combo Box (200

    I've accepted that they just won't be blank. My desire to have it that way was purely aesthetic; I'm just surprised that there's not an easy fix to it.

    Thanks for all responses!

  8. #8
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Default values in form based on Combo Box (200

    I hide the Detail section routinely now because complain to me if I don't.

    They say that the data in the first record keeps getting corrupted because people type into it by mistake.
    Regards
    John



  9. #9
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Default values in form based on Combo Box (200

    I just changed one of my forms to a pop up to test this.

    Set the AutoResize Property of the form to NO.
    Set the AutoCenter property of the form to NO.

    When the form first comes up Move it and Resize it so it is the Position and Size you want, then type CTRL S to save these settings.
    For me the form then opens at the size I want, even though the Detail Section is blank.
    Regards
    John



Posting Permissions

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