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

Requery after Delete in continuous subform

Status
Not open for further replies.

kimsMTC

Programmer
May 30, 2007
50
US
I have a form and subform with my subform being a continuous form. It lists timesheet records in a Tabular format. I have a command button that has the following code to delete the record that has focus in the Tabular form:

Private Sub BtnDelete_Click()
With Me.TimesheetRecords
DoCmd.RunCommand acCmdDeleteRecord

Me.TimesheetRecords.Form.Requery
End With
End Sub

The "Requery" does not refresh my subform with any data. All data is blanked out. What am I doing wrong?

Thanks!
 
What about this ?
Private Sub BtnDelete_Click()
With Me.TimesheetRecords.Form
.SetFocus
DoCmd.RunCommand acCmdDeleteRecord
DoEvents
.Requery
End With
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I had to modify your code to avoid errors. Then I get "delete record is not available now":

Private Sub BtnDelete_Click()
With Me.TimesheetRecords
.SetFocus
DoCmd.RunCommand acCmdDeleteRecord
DoEvents
.Requery
End With
End Sub
 
Where is located your button ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Why not putting it in the Footer section of the subform and so the subform will not lost focus when you click the button ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top