Deleting New Records on Subforms

grovelli

Registered User.
Local time
Today, 08:21
Joined
Apr 3, 2005
Messages
16
In the attached mdb, is there a way to avoid the RecordSource of the subform being incremented by one day every time you open the main Dezzo form?
Try opening and closing the Dezzo form a few times; you'll see records being added to the g1dez and g2dez tables.
I'm using the following code in the On Current procedure of the subform to remove the record that's been added to the subform RecordSource

Dim cmd1 As ADODB.Command
Set cmd1 = New ADODB.Command
With cmd1
.ActiveConnection = CurrentProject.Connection
.CommandText = "DELETE FROM g2dez" & _
" WHERE giorno = #" & _
Format(Me.Parent.Form.CGior, "mm/dd/yyyy") & "#"
.CommandType = adCmdText
.Execute
End With
Set cmd1 = Nothing


but why then does the RecordSource still retain that record?
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom