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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clearing Continuous Forms 1

Status
Not open for further replies.

billmsacces

Programmer
Feb 2, 2004
16
0
0
US
I am trying to clear a continuous form using the following code.

Private Sub ClearForm_Click()
Do While Me.NewRecord = False
field1 = 0
field2 = 0
field3 = 0
DoCmd.GoToRecord acDataForm, "form1", acNext
Loop
End Sub

It works fine until it reaches the DoCmd.GoToRecord line.
I get the follwing error.

Run-time Error '2105':
You can't go to the specified record.

How can this be resolved?
 
It looks like the Allow Additions property of your form is set to No.
Set Allow Additions to Yes and it should work.
If the design of your database can't allow this, try using errortrapping.

Private Sub ClearForm_Click()

On Error GoTo Errorhandler

Do While Me.NewRecord = False
field1 = 0
field2 = 0
field3 = 0
DoCmd.GoToRecord acDataForm, "form1", acNext
Loop

Errorhandler:

err.clear

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top