PDA

View Full Version : forms & multipage forms



northernstar
10-07-2007, 09:54 AM
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

Oorang
10-08-2007, 02:12 PM
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: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

northernstar
10-09-2007, 10:09 AM
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

Oorang
10-09-2007, 01:11 PM
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