Records inside a form

rwahdan

New member
Local time
Today, 00:55
Joined
Feb 11, 2006
Messages
9
Hi,

I am using DAO to get the records from table. I have a form that has text fields to enter the records. I have a button called Next Record and i need it to show next record in recordset in the same form using same textboxes.
 
docmd.runCommand acCmdRecordsGotoNext

Any reason you don't want to use the inbuilt navigation provided with the form?
 
docmd.runCommand acCmdRecordsGotoNext

Any reason you don't want to use the inbuilt navigation provided with the form?

Thanks for the reply, the reason is I am making an exam engine and i want to view next question which is in the record set.

That didn't work as i am loading data on form load, when i click on button then i need to go to next record in the table, how can this be done?

Thanks

Code:
Private Sub Form_Load()

Dim db1 As DAO.Database
Dim rst1 As DAO.Recordset
Dim db2 As DAO.Database
Dim rst2 As DAO.Recordset
Dim gradeid As Integer

Set db2 = CurrentDb

    Set rst2 = db2.OpenRecordset("SELECT * FROM grade4MultiQuestions")
    question.Caption = rst2!question
    gradeid = rst2!grade4MultiID
    
    
Set db1 = CurrentDb

    Set rst1 = db1.OpenRecordset("SELECT * FROM grade4MultiAnswers where grade4MultiQuestionsID = " & gradeid & "")
    answer1.Caption = rst1!answer3
    answer2.Caption = rst1!answer1
    answer3.Caption = rst1!answer2
    lblcorrect.Caption = rst1!correctAnswer

End Sub
 
Consider that if you look at Me.Recordset.Clone, you can do recordset operations on that copy of the form's intrinsic recordset. You can do a Me.Recordset.Clone.MoveNext or you can assign a recordset variable such as

Code:
Set RSClone = Me.Recordset.Clone
RSClone.MoveNext
X = RSClone![fieldname]
etc. etc.

That would enable you to use the form for normal things and the clone for previewing whatever it is that you want to preview.
 
What problem did you have with using the normal record source for your form?
 

Users who are viewing this thread

Back
Top Bottom