Access 2003 Records question (help!)

  • Thread starter Thread starter Daryl
  • Start date Start date
D

Daryl

I'm pretty new to Access programming and I am fumbling thru my first database
so far so please bear with me.
I'm trying to create a form that (like a slideshow) will open and display the
fields on the form based on the records from that table for a certain amount of
time and then close when it gets to the last record.

I assume I would use the ontimer event, but how do I get it to stop after it
has shown the last record of the table?

Sample code would be greatly appreciated.

Thanks in advance

Daryl
 
Daryl said:
I'm pretty new to Access programming and I am fumbling thru my first
database so far so please bear with me.
I'm trying to create a form that (like a slideshow) will open and
display the fields on the form based on the records from that table
for a certain amount of time and then close when it gets to the last
record.

I assume I would use the ontimer event, but how do I get it to stop
after it has shown the last record of the table?

Sample code would be greatly appreciated.

Thanks in advance

Daryl

Probably the easiest way is just to set the form's AllowAdditions
property to No, and have the code in your Timer event just close the
form when an error is raised by the statement that moves the form to the
next record. Here's a quick example:

'----- start of example code -----
Private Sub Form_Timer()

On Error GoTo Err_Handler

RunCommand acCmdRecordsGoToNext

Exit_Point:
Exit Sub

Err_Handler:
Me.TimerInterval = 0
DoCmd.Close acForm, Me.Name, acSaveNo
Resume Exit_Point

End Sub
'----- end of example code -----
 
Back
Top