John Jnr
Registered User.
- Local time
- Today, 06:19
- Joined
- May 2, 2002
- Messages
- 36
I have searched the forum and used every know possible solution to this!
All I want to do is click on the parts in a list box hit a delete button and it then deletes those records from the relative table.
Simple you think, then please help!
Here is some sample code for you yo laugh at, and represents last attempt before I pulled my hair out!
Private Sub Command40_Click()
On Error GoTo Err_Command40_Click
Dim frm As Form, ctl As Control
Dim varItm As Variant, intI As Integer
Dim par As Recordset
Dim dbsamanda As Database
Dim leg As Long
Set frm = Forms!EnterParts
Set ctl = frm!List32
Set par = dbsamanda.OpenRecordset("Table1")
leg = par!PartNumber
For Each varItm In ctl.ItemsSelected
For intI = 0 To ctl.ColumnCount - 1
DeleteRecord par, leg
Next intI
Next varItm
Exit_Command40_Click:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit Sub
Err_Command40_Click:
MsgBox Err.Description
Resume Exit_Command40_Click
Thanks in advance
All I want to do is click on the parts in a list box hit a delete button and it then deletes those records from the relative table.
Simple you think, then please help!
Here is some sample code for you yo laugh at, and represents last attempt before I pulled my hair out!
Private Sub Command40_Click()
On Error GoTo Err_Command40_Click
Dim frm As Form, ctl As Control
Dim varItm As Variant, intI As Integer
Dim par As Recordset
Dim dbsamanda As Database
Dim leg As Long
Set frm = Forms!EnterParts
Set ctl = frm!List32
Set par = dbsamanda.OpenRecordset("Table1")
leg = par!PartNumber
For Each varItm In ctl.ItemsSelected
For intI = 0 To ctl.ColumnCount - 1
DeleteRecord par, leg
Next intI
Next varItm
Exit_Command40_Click:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit Sub
Err_Command40_Click:
MsgBox Err.Description
Resume Exit_Command40_Click
Thanks in advance
