It Says NO CURRENT RECORD

D

DS

I'm running this code and after I delete the last item it says:
"No Current Record"
How do I get this thing to stop once there are no more record?
Thanks
DS

Private Sub Command74_Click()
If [Sent] = True Then
DoCmd.OpenForm "CantItem"
ElseIf [ItemType] = "2" And [Text70] > 1 Then
DoCmd.RunCommand acCmdDeleteRecord
Me.Refresh
ElseIf [ItemType] = "1" And [Text70] = 1 Then
DoCmd.RunCommand acCmdDeleteRecord
Me.Refresh
ElseIf [ItemType] = "1" And [Text70] > 1 Then
CurrentDb.Execute "DELETE FROM SalesDetails WHERE [LineID]=" & [Text72]
Me.Requery
Me.Parent.Requery
End If
With Forms!Sales.SalesDetails.Form.Recordset
If Forms!Sales.SalesDetails.Form!Text127 = 0 Then
Do While .EOF = False And .BOF = False
.MoveFirst
.Edit
!SDInclusive = True
!SDTaxed = False
.Update
.MoveNext
Loop
End If
End With
DoCmd.GoToRecord , , acLast
End Sub
 
M

Michael J. Strickland

I think you need a check for an empty table (EOF or BOF) at the beginning of
your
Command74_Click() routine so you can exit if table is empty.
 
D

DS

Michael said:
I think you need a check for an empty table (EOF or BOF) at the beginning of
your
Command74_Click() routine so you can exit if table is empty.
How would I phrase that?
Thanks
DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

IF Statement 5
Nested IF 7
Flickering Fields 1
DLookUp Trouble 3
No Records Then 4
Delete - Error 3021: No current record 5
Copy record into same table 1
cannot delete last record with code 1

Top