Results 1 to 15 of 15
  1. #1
    Join Date
    Apr 2007
    Posts
    81

    Unanswered: I need open the form with specific size.

    Hi to everyone

    I need open the form with specific size.

    thanks

  2. #2
    Join Date
    Feb 2007
    Posts
    348
    make sure the auto resize and auto center attributes on the form are set to no.

  3. #3
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    in the Form_Load() method, put
    Code:
    DoCmd.MoveSize , , width, height

  4. #4
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    Why not set the form size in Design view? Set the Detail section to the dimensions you want, set the AutoResize = Yes, and also set the Border Style to Dialog (so no one can change it).

  5. #5
    Join Date
    Nov 2003
    Posts
    1,487
    The DoCmd.MoveSize , , width, height as jmahaffie has clearly pointed out is ideal for both positioning and or sizing your Form while in run mode. For example:

    Suppose you have a Form and within that Form you also have a SubForm nested near the bottom which contains further details of the record currently in view within the main form. If the user wants to see or edit (or whatever) the contents of the SubForm then with selection of a Command Button control the MoveSize method is fired to expose the SubForm. Click it again and the Form collapses to once again hide SubForm. A horror story on Form mouse action if you know what I mean.

    anywho....

    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


  6. #6
    Join Date
    Feb 2007
    Posts
    348
    Quote Originally Posted by DCKunkle
    Why not set the form size in Design view? Set the Detail section to the dimensions you want, set the AutoResize = Yes, and also set the Border Style to Dialog (so no one can change it).
    set it to yes? really. I had it backwards then. My bad.

  7. #7
    Join Date
    Apr 2007
    Posts
    81
    HI

    I used both advices for jmahaffie and DCKunkle and that is ok when I open the main form in minimize, but when I open the main form in maximize, the detail Form unable the specific size.

    thanks

  8. #8
    Join Date
    Nov 2003
    Posts
    1,487
    Disable the Maximize button on Form. You can do this with the Form's Min Max Buttons property.

    If you really need the Minimize button then select Min Enabled. If you don't need either Minimize or Maximize buttons then select None.

    I can understand Minimize but why bother sizing if you allow users to Maximize.
    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


  9. #9
    Join Date
    Apr 2007
    Posts
    81
    Hi

    I can understand Minimize but why bother sizing if you allow users to Maximize.
    .

    Main form open in maximize and by double click open detail form in specific size.

    I used your advise (Min Max Buttons property = None),
    The detail form open specific size when I open the main form in minimize.and unable when I open the main form in maximize,

    I need open the main form in maximize and detail form in specific size.

    thanks

  10. #10
    Join Date
    Nov 2003
    Posts
    1,487
    Hmmm....I must be missing something here. My apologies.

    Are we dealing with two Forms here or is it that we are dealing with the Access MDI Parent and a MDI child Form. At this point...it might not be a bad idea to see a picture of what you want things to look like.

    Perhaps what you need to do is to set your details form Border Style property to Dialog as DCKunkle had sugested much earlier. You don't need to size things then.

    Just curious......the details Form isn't a SubForm is it?

    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


  11. #11
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I think SAMI2's detail form is a subform from the previous examples he's uploaded.

    SAMI2, I think you need to move the fields around in your detail (subform) to fit into the designated size the subform is on the main form. Don't try to resize your subform in code. It doesn't make any sense to do this in your situation.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  12. #12
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Note that DoCmd.MoveSize doesn't use pixels as a measurement, therefore your results may vary depending on resolution
    George
    Home | Blog

  13. #13
    Join Date
    Apr 2007
    Posts
    81
    Hi

    you can see to the sample.

    click to the country name to open the detail form.
    Attached Files Attached Files

  14. #14
    Join Date
    Nov 2003
    Posts
    1,487
    Attached is your Form Sample returned to you with what I think is what you want to do.

    For the PhonCodDetailFrm Form:

    - I commented the DoCmd.MoveSize (no need for it);
    - I set the Auto Resize and Auto Center properties to Yes and sized Form
    - I set the Pop Up Property to Yes. (This is all what you really needed to do in your case).

    If you want no interaction done in the Main Form while the PhonCodDetailFrm is visible then set the Modal property for the PhonCodDetailFrm Form to Yes.

    Another way you could have accomplished all this is where your code is to Open the Form to begin with. Currently you have:

    DoCmd.OpenForm DetailForm, , , "id=" & Me.ID

    If you were to use:

    DoCmd.OpenForm DetailForm, , , "id=" & Me.ID, , acDialog

    all your problems would have been solved. A Form that is Opened in Dialog mode can not be sized, as a matter of fact, the Min Max buttons are not even available to Forms Opened in Dialog Mode. Also, Forms opened in Dialog mode are Modal which means the Form will need to be closed before you can carry on with other areas of the Database. This also holds true in Code.

    Good Luck with your project SAMI2.

    .
    Attached Files Attached Files
    Last edited by CyberLynx; 11-16-07 at 06:53.
    Environment:
    Self Taught In ALL Environments.....And It Shows!


  15. #15
    Join Date
    Apr 2007
    Posts
    81
    thanks, all ! I greatly appreciate it.

    and thanks lot for CyberLynx for your help, it was very useful to learn it.
    Last edited by SAMI2; 11-17-07 at 05:24.

Posting Permissions

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