Hello,
How Does One Create Like a User Wizard for inputting data into a table
which holds about 30 fields
Wizards are often done with Tab controls, with the Tab Style set to None ... you then use syntax like this to move back
and forth to the tabs:
Me.YourTabControl.Pages(2).SetFocus
I normally use a Select Case structure to handle the various items; it can get pretty complex, but with only 3 tabs it
should be pretty simple. In the example below, my tab control is named tabReportWizard,
Select Case Me.tabReportWizard
Case Me.tabReportWizard.Pages("pgeMain").PageIndex
Me.tabReportWizard.Pages("pgeReportType").SetFocus
Case Me.tabReportWizard.Pages("pgeReportType").PageIndex
Me.tabReportWizard.Pages("pgeSelectFields").SetFocus
Case Me.tabReportWizard.Pages("pgeSelectFields").PageIndex
Me.tabReportWizard.Pages("pgeFinish").SetFocus
Case Else
End Select
Of course you must also handle when the user wishes to progress backwards in the wizard (if you support that); in that
case, the Select Case is pretty much the reverse of what's above:
Select Case Me.tabReportWizard
Case Me.tabReportWizard.Pages("pgeMain").PageIndex
'/do nothing - this is the first page
Case Me.tabReportWizard.Pages("pgeReportType").PageIndex
Me.tabReportWizard.Pages("pgeMain").SetFocus
Case Me.tabReportWizard.Pages("pgeSelectFields").PageIndex
Me.tabReportWizard.Pages("pgeReportType").SetFocus
Case Me.tabReportWizard.Pages("pgeFinish").PageIndex
Me.tabReportWizard.Pages("pgeReportType").SetFocus
Case Else
End Select
As the user progresses along the wizard, you'd collect the data and ONLY when they click the Finish button would you
then input the data ... you can do so with SQL:
Sub btnFinish_Click()
Currentdb.Execute "INSERT INTO SomeTable(Col1, Col2, Col3) VALUES(Val1, Val2, Val3)"
End Sub
Val1, Val2, and Val3 would be information inputted by the user ... how you store that is up to you, but you can use
form-level variables, User Defined Types, class modules, etc. UDTs are especially useful for this.
The Aim Its to have the Wizard fill in the Projects Table in like 3
seperate Windows
Which i would assume id have to create 3 seperate Forms With The
Required Fields on Each Form with a Next Buttom Command which would
open the Next Form in The Wizard.
If you do it this way, you'll end up with incomplete records, since Form1 would input a record, then Form2 would input a
different record, etc etc ... you could do it like this, wiht your First form entering the new record, then the
subsequent forms simply Updating that record ... could be tricky, and data integrity would depend on timing as much as
anything (and that's never good).
But it Carry's on Imputting the data in the same record? how do i do
this?
Regards
Dan
Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com