Delete a record and later again?

Frits1969

New member
Local time
Tomorrow, 00:25
Joined
Aug 9, 2010
Messages
6
I've a form with tabs on it.
Some tabs has a subform on it.
I select tab 1 (with a subform). This subform has closed Details. I open the Details and show a new record.
Then I choose a other tab. It use this VBA-code

Private Sub TabbestEl6_Click()
' bij keuze, voor het geval er al een keuze was. Me.menukeuze=oude keuze
Select Case Me.menukeuze
Case 1
If IsNull(Me!FormulierDagboek.Form.nummer) Then
Me!FormulierDagboek.Form.nummer = Null
Me!FormulierDagboek.Form.Undo
Else
Me!FormulierDagboek.Form.omschrijving.SetFocus
Me!FormulierDagboek.Form.Recordset.Delete
End If
Me!FormulierDagboek.Form.Details.Visible = False
Me!FormulierDagboek.Form.Toevoegen.Visible = True
End Select
'bij keuze hier de nieuwe keuze aan Me.menuekeuze toekennen
Select Case TabbestEl6
Case 0
Me.menukeuze = 0

Case 1
Me.menukeuze = 1

Case 2
Me.menukeuze = 2

Case 3
Me.menukeuze = 3

Case 4
Me.menukeuze = 4

End Select
Me.Refresh
End Sub

So far so good.
Then I do the same again, but then it tells me I don't have a current record.

What do I do wrong? Who can help me.

Regards,
Frits
 
Thanks for the quick answare MDlueck. But I don't understand.
First I go to tab 1, and onen a new record.
Then I go tab 2 and back to tab 1. I open a new record again. This seems right. but when I go to tab 2 again, I get the message "no current record". It's when I try to delete it.

So the first delete action is ok, but the second isn't.
 
But I don't understand.

So the first delete action is ok, but the second isn't.

In order for a form refresh to pick up on changes in the table I, as well as others, have noticed that Access expects the Form's RecordSource property to be touched (very well could be to exactly the same value that was already in the property) THEN a Refresh will pick up on actual changes in the table.

So, I am thinking perhaps why you get the error is that the Form's memory of what should be in the table and the actual table are different, the Form gets confused, and throws an error.
 

Users who are viewing this thread

Back
Top Bottom