Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Tabs 1

Status
Not open for further replies.

JamesLynch

Technical User
Oct 30, 2002
11
GB
I wish to create a four sections type questionaire, using a tab for each section.

What do I need to do to forcce the end user to complete all the fields in the first section / tab before moving onto the next.

I also need to ensure that each tab is completed before a new record can be started.


Thanks
James
 
Hallo,

One way to do this is to make all but the first tab invisible. Then put a 'next' button at the bottom (right) of each tab. Only make this button enabled when the data has been completed for that tab. Clicking the Next button makes the next Tab visible.
The 'Next' Button on the last tab could say 'Finish', or whatever.
You need to make sure that the user does not change previous tabs. You can do this by making previous tabs disabled.
If you want to enable users to change previous tabs then you'll have to put more complicated checks, making subsequent tabs invisible if the data on the current tab is changed so that it is no longer valid.

Sounds a bit long winded but it's not too bad (and will give you an HCI to be proud of)

One simple way to do it is to write a function called:
Code:
Function SetTab1ButtonValidity()
  dim ysnValidity as boolean
  ysnValidity= True
  with me
    if "" & !Name = "" then ysnValidity=False
    if "" & !Address1 = "" then ysnValidity=False
    if "" & !Address2 = "" then ysnValidity=False
    if isnull(!Month) then
      ysnValidity=false
    else
      if IsNumeric(!Month) then
        If !Month<1 or !Month>12 then ysnValidity = false
      else
        validity = false
      endif
    endif
    !btnTab1Next.Enabled = ysnValidity
  end with
end function

In the AfterUpdate Property of each editable control, put:
=SetTab1ButtonValidity()
(You can do this in one go by selecting all the controls)
Each time one of these controls is changed, the function will run and the Next button set up accordingly. Sweet.

You'll need a separate function for each Tab,

- Frink
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top