Consulting

Results 1 to 4 of 4

Thread: forms & multipage forms

  1. #1

    forms & multipage forms

    hi everyone (again!)

    just a couple of quickies

    is it possible to:-

    autotab after a selection has been made from the dropdown (valid value entered via keyboard) even if the entry character length may vary

    clear (unload) a page on a multipage form when it has been reselected after returning to the first page
    for example - three pages

    intro
    personal
    general

    complete the intro page then continue to personal and then decide that the intro was filled incorrectly, return to the intro and then return to personal (as an unfilled in form) and then finally continue to general

    hope this makes sense?

    thanks in advance

  2. #2
    Knowledge Base Approver VBAX Master Oorang's Avatar
    Joined
    Jan 2007
    Posts
    1,135
    Location
    Hi NS
    I don't know of a way to do the dropdown thing without going through a lot of hitdetection on the mousepointer position. Someone else might know of a better solution.
    I think this will work for your second problem:[VBA]Option Explicit

    Private m_blnAllowAutoClose As Boolean

    Private Sub Form_Open(Cancel As Integer)
    'Safeguard in case values get saved in:
    Me.TimerInterval = 0
    Me.Visible = True
    End Sub

    Private Sub Text4_GotFocus()
    'Don't allow autoclose until Text4 has been access at least once.
    m_blnAllowAutoClose = True
    End Sub

    Private Sub Text1_GotFocus()
    Const strExitControl_c As String = "Text4"
    Dim ctrlLast As Access.Control
    On Error Resume Next
    If m_blnAllowAutoClose Then
    Set ctrlLast = Access.Screen.PreviousControl
    On Error GoTo 0
    If Not ctrlLast Is Nothing Then
    If ctrlLast.Name = strExitControl_c Then
    'You cannot close a form until the GotFocus event ends
    'so hide the form and use a delayed close.
    Me.Visible = False
    Me.TimerInterval = 1
    End If
    End If
    End If
    End Sub

    Private Sub Form_Timer()
    If m_blnAllowAutoClose Then
    Access.DoCmd.Close acForm, Me.Name
    End If
    End Sub
    [/VBA]
    Cordially,
    Aaron



    Keep Our Board Clean!
    • Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
    • Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.

  3. #3

    clearing a form page

    hi

    i dont fully understand your code, will this clear one page on the form or all the pages and then close the form?

    not sure if i explained it very well?

    but basically it a form with two pages on it and the user has to complete all the boxes on page 1 before they can move to page 2, but if they then decide to go back to page 1 then they must start again when they return to page 2

    hope this is a little clearer

    sorry if you understood the first and it is me who clearly doesnt understand your code (please explain in detail)

    many thanks

  4. #4
    Knowledge Base Approver VBAX Master Oorang's Avatar
    Joined
    Jan 2007
    Posts
    1,135
    Location
    Ahh you threw me when you said Unload. There is an unload action that can be used to close MSForms's UserForms. It doesn't work with Access Forms, but I figured you were just used to working with Excel.
    Maybe we should ask some questions what are you referring to when you say "Page"? The TabControl's page SubObject? Also this whole bit seemed subcohesive
    but basically it a form with two pages on it and the user has to complete all the boxes on page 1 before they can move to page 2, but if they then decide to go back to page 1 then they must start again when they return to page 2
    Cordially,
    Aaron



    Keep Our Board Clean!
    • Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
    • Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.

Posting Permissions

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