Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2010
    Posts
    41

    Unanswered: Only 2 fields in form

    Hi there,

    Im in the process of designing quite a few forms and some of the tables have only a primary key with 1 attribute...i am creating a data entry form for each table and im not sure how i should create the forms with only 2 fields in terms of layout - i will have a huge chunk of the screen just blank which is not very user friendly i say

    How about would someone go in creating a data entry form with only 2 fields

    Also how do i automatically centre everything on my form?

    Thanks

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Nothing prevents you from creating a tiny form, so you would not have big blank parts on it.
    With only two controls on the form, centering them should not be too difficult!
    Attached Thumbnails Attached Thumbnails ScreenShot089.jpg  
    Have a nice day!

  3. #3
    Join Date
    Mar 2010
    Posts
    41
    OK - how do i center big forms then

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    or consider using the continuous forms paradigm
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    If you're talking about the alignment of the controls on a form, you can obtain very precise results whith some code.
    Create a form, place several textboxes on it in the order you want them to be placed but without aligning them. In an independant module, use a function like this (it's just an example):

    Code:
    Dim frm as Form
    Dim ctl as Control
    Dim lngTop as Long
    
    DoCmd.OpenForm "<FormName>", acDesign
    Set frm = Forms!<FormName>
    lngTop = 567
    For Each ctl In frm
        If ctl.ControlType = acTextbox then
            ctl.Left = 567
            ctl.Top = lngTop
            lngTop = lngTop + 200
        End If
    Next
    Set frm = Nothing
    For centering the form on the screen, you can use the AutoCenter property of the form. You can also make the form independant (more or less) from the Access main windows by setting its PopUp property to True.

    You can also work with several Windows API (MoveWindow, AdjustWindowRectEx, etc.) to move the form and/or place it on the center of the screen. This suppose however that you're somewhat familiar with the Windows APIs and know how to use them with VBA code. It can become fairly complex, specially if you work with a system configured to use several monitors at once.
    Have a nice day!

  6. #6
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Nice example Sinndho
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  7. #7
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Thanks Pkstormy!
    Have a nice day!

  8. #8
    Join Date
    Mar 2010
    Posts
    41
    Quote Originally Posted by Sinndho View Post
    If you're talking about the alignment of the controls on a form, you can obtain very precise results whith some code.
    Create a form, place several textboxes on it in the order you want them to be placed but without aligning them. In an independant module, use a function like this (it's just an example):

    Code:
    Dim frm as Form
    Dim ctl as Control
    Dim lngTop as Long
    
    DoCmd.OpenForm "<FormName>", acDesign
    Set frm = Forms!<FormName>
    lngTop = 567
    For Each ctl In frm
        If ctl.ControlType = acTextbox then
            ctl.Left = 567
            ctl.Top = lngTop
            lngTop = lngTop + 200
        End If
    Next
    Set frm = Nothing
    For centering the form on the screen, you can use the AutoCenter property of the form. You can also make the form independant (more or less) from the Access main windows by setting its PopUp property to True.

    You can also work with several Windows API (MoveWindow, AdjustWindowRectEx, etc.) to move the form and/or place it on the center of the screen. This suppose however that you're somewhat familiar with the Windows APIs and know how to use them with VBA code. It can become fairly complex, specially if you work with a system configured to use several monitors at once.
    Thanks for the info - im pretty new to VB and im stil learning how to create things with VB

  9. #9
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Posting Permissions

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