Results 1 to 1 of 1

Thread: Deleting New Records on Subforms

  1. #1
    Join Date
    Nov 2005
    Posts
    1

    Question Deleting New Records on Subforms

    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?
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •