Tab Control (1 Viewer)

sohailcdc

Registered User.
Local time
Today, 10:25
Joined
Sep 25, 2012
Messages
55
Hi there
I am trying to learn different feature of form "Controls" in access during my free time, nothing particular in order

Right now I am trying to play with "Tab Control"
My Tab Control have two tabs "Page1" and "Page2"
Here's what I am looking for

My "Page1" have two fields
What I want, until both fields are not properly filed, "Page2" needs to be disable

Secondly, can i move from "Page1" to "Page2" or vise versa, using button command instead of selecting tab

Thanks in advance
 

damian

Registered User.
Local time
Today, 18:25
Joined
Jun 27, 2004
Messages
87
Are you familair with VBA - you could use on your command button to check that all controls are completed and call following function:

Code:
Private Function CheckForCompletion() As Boolean
'will check only controls with 'CheckPage1' in Tag property  (Form Properties under 'Other' tab)
'IMPORTANT for this to work - labels (ie captions) have to be associated with the fields
   CheckForCompletion = True
   Dim ctl As Control
   Dim strName As String
    Dim ctrl2 As Control
   For Each ctl In Me.Controls
     'Check if controls on this page with Checkpage1 tag have been completed
   If ctl.Tag = "Checkpage1'" Then
     If IsNull(ctl) Then
       strName = ctl.Controls(0).Caption
           CheckForCompletion = False
              MsgBox "Please fill in the " & Chr(34) & strName & Chr(34) & " field."
       ctl.SetFocus
       Exit Function
     End If
     End If
    Next ctl
    DoCmd.RefreshRecord
DoCmd.Save

'this would take you from page 1 to page 2 (change TabCtlName to name of 'your tab control)


Me.TabCtlName.Value = Me.TabCtlName.Value + 1
End Function







this would take you from page 1 to page 2 (change TabCtlName to name of your tab control)


Me.TabCtlName.Value = Me.TabCtlName.Value + 1
 

Users who are viewing this thread

Top Bottom