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

Delete entry from form and table

Status
Not open for further replies.

noahaz

Technical User
Aug 15, 2005
30
0
0
US
Hello,
I have created a delete selection in my combo box on my form. When I choose delete from the dropdown from the combo box in the form the job from both the table and the form should be gone.
Here is what I have thus far:

Private Sub Combo16_CmdOk()
If Me.Combo16 = "Delete"
Then DoCmd.RunCommand acCmdDeleteRecord
End If
End Sub

This seems to be deleting the job from the form but it is still in my table. How do I get rid of them both?
 
1) Make sure you name your controls something useful rather than the generic names generated by Access. You'll thank yourself later when you have to go back and fix something.


Dim rst as recordset
set rst = Me.RecordsetClone
rst.Delete
Me.Requery

Make sure to destroy the rst object before exiting the routine.

Larry
 
Private Sub Combo16_AfterUpdate()
If Me.Combo16 = "Completed" Then
Me.Date_Closed = Date
End If
End Sub

Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.Delete
Me.Requery

This isn't working, did I do something wrong?
 
Private Sub Combo16_CmdOk()
Dim rst as recordset
If Me.Combo16 = "Delete"
set rst=me.recordsetClone
rst.Delete
me.Requery
End If

ExitHandler:
If not rst is nothing then
rst.close
set rst=nothing
ENd if
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top