data tranfer from one form to another without storing data in db table

RunLikeaRiver

Registered User.
Local time
Today, 09:35
Joined
Oct 27, 2005
Messages
18
Hi
I have some 100 questions for which user must answer by selecting any of the options provided using option buttons.

As i cant fit all 100 qtns in one form am splitting it into soem 10 forms.

User answers the qtns in 1st form and clicks on next button to goto to nxt form
thn agn he answers the qtns in tht form and clicks on next button to goto nxt form..so on.. until he answers all the qtns in the last form.

I want to transfer the answers selected from 1st form till the last one..where all the answers are stored in one table whn a submit button is clicked.

please let me kno ASAP if thr is anyway i can do it.
thnk in advance
 
why doen't you create a continous form. One form with many pages. Put a command button at the bottom of each page that continues to next page.

Simply one form that saves to one table

Ash
 
hi thnx for teh info...
but am new to ms access. I dont kno how to create a continous form.
Can u help me please
thnx
 
ok 1st create a form in design view.

then click on propeties of form and bind it to the table that holds records.

then on toolbox select tab option.

it usually alows two tab pages. to insert more pages just right click insert page. you will have to play around with sizing. when you bound the table it should have opened a field list box. if not open it from toolbar menu. now design the way you want the form to look with your questions.

next you need to add a command button at the bottom of each tab that says continue.(and i suppose end on the last page.)

do not use the wizard to create command buttons as you want to use vba code to move to the next page.

next on form properties go to event and on form load add vba code.

the code would look similar to this:

Private Sub Form_Load()
Me.Page1.Visible = True
Me.Page2.Visible = False
Me.Page3.Visible = False
Me.Page4.Visible = False

End Sub

create a control button on the form footer (if it is not there right click on form click on "form header/footer"

i have called the control button continue1 (make sure you have the wizard turned off when you create control button) to change properties of control box right click and go to properties. while in properties go to event on click and add this code:
Option Compare Database
Option Explicit


Private Sub Form_Load()
Me.Page1.Visible = True
Me.Page2.Visible = False
Me.Page3.Visible = False
Me.Page4.Visible = False

End Sub

Private Sub Continue1_Click()


If Me.Page3.Visible = True Then
Me.Page1.Visible = False
Me!Page2.Visible = False
Me!Page3.Visible = False
Me!Page4.Visible = True
End If

If Me.Page2.Visible = True Then
Me.Page1.Visible = False
Me!Page2.Visible = False
Me!Page3.Visible = True
Me!Page4.Visible = False
End If

If Me.Page1.Visible = True Then
Me!Page1.Visible = False
Me!Page2.Visible = True
Me!Page3.Visible = False
Me!Page4.Visible = False
End If

NB if you need to add more pages just add the same code make sure you put the pages in desecnding order eg 10,9,8,7.

If you want to add a back button to go back to previous page. Do the same as continue however make sure your pages go in ascending order eg 1 2 3.

The last control i would put in is a save/close command on the last page use the wizard to do this

Hope this helps

Ash
 
Last edited:
Well..........

Excuss me for inserting my "2 cents" worth here...... But why all the code??
Seems totally unnecesary.
First..... On load your form is going to open to tab "page one".
And why all the IF statements?
I have never been able to view multiple tabbed pages...... If one is visible... the others will not be..... No code is needed.
Why not one simple line of code on the "ContinueToPage2 Button"

Private Sub ContinueToPage2_Click()
Me!FirstFieldofPage2.SetFocus
End Sub

Maybe there is a reason for all the code....... But when possible I just let "Access" do its thing.
 
Ceh

The reason i suggested the code is that usually in questions and answer forms you don't whant your user to skip pages. This code allows the user to answer a page at a time. If it was me i would put further code in to make sure all required fields are filled in before it would let you proceed. This way the adminstrator can have control over the form. If you left it up to the user they would skip to the end in most cases.

Ash
 
Just saying let Access do its thing...... As far as I have ever seen you can not open two tabs at once.... Coding the "visible" is simply not needed. And required fields can be set on tables. VBA is fantastic for things Access can not do, or is not built into it. But as they say........ "If it ain't broke, don't fix it"
 
I made a mistake when i said code i ment property fields for *required field*

However by making the tab invisible it allows you the adminstrator to have more control. I believe that this is for a survey db. (i could be wrong) if so then i would make the tabs invisible. If it where for simply data entry then i wouldn't make the tabs invisible.

Sometimes it is better to have more control over the forms. But either way both the arguments for for/against could go on for ever. Since i don't have enough information on the project being compiled (just what was given) i interpreted it one way and offered a solution.

Runlikeariver you have both sides you need to make a choice on what best fits your criteria. Hope that we (CEH and myself have offered help to you).

Thanks
Ash
 
but am new to ms access.
Then you certainly don't want to continue on your present path. You have created a spreadsheet - NOT a table. You will find that Access is an excellent relational database manager. It is a poor spreadsheet manager.

Search the forum for suggested designs and samples of surveys and questionnaires. NONE of them will suggest hard coded questions with all answers in a single row. The actual suggestion you choose will depend on your other requirements but ultimately, you'll end up with an "answer" table that looks something like:
tblClientAnswers:
SurveyID (primary key fld1, foreign key to tblSurvey)
QuestionID (primary key fld2, foreign key to tblQuestions)
ClientID (primary key fld3, foreign key to tblClient)
Answer

Your present structure has 100 answers in one row. The recommended solution has one row per answer. If you ever need to do any analysis of the answers, the recommended solution is the ONLY way to do it unless you're into serious VBA coding and tons of queries.
 

Users who are viewing this thread

Back
Top Bottom