A
auujxa2 via AccessMonster.com
I'd like to use the values from rst (DeptQry) instead of the items selected.
Here is my current code for the items selected. Please let me know how to
change it from the items selected to DeptQry results. Thank you in advance.
Dim strSQL As String
Dim varItem As Variant
Dim frm As Form, ctl As Control
Set frm = Forms!frmSetup
Set ctl = frm!lstMyDepartments
Set db = OpenDatabase("F:\Vendor Matrix\Data\Source\Maintenance Database -
F09\MENS Fall FY09 Vendor Maintenance.mdb")
Set rstDate = db.OpenRecordset("MasterTbl")
For Each varItem In ctl.ItemsSelected
strSQL = "DELETE * FROM [MasterTbl] IN 'F:\Vendor Matrix\Data\Source\
Maintenance Database - F09\MENS Fall FY09 Vendor Maintenance.mdb'" & _
" WHERE [Department #] = " & ctl.ItemData(varItem) & ""
DoCmd.RunSQL strSQL
Next varItem
Else
End If
DoCmd.Quit
End Sub
Here is my current code for the items selected. Please let me know how to
change it from the items selected to DeptQry results. Thank you in advance.
Dim strSQL As String
Dim varItem As Variant
Dim frm As Form, ctl As Control
Set frm = Forms!frmSetup
Set ctl = frm!lstMyDepartments
Set db = OpenDatabase("F:\Vendor Matrix\Data\Source\Maintenance Database -
F09\MENS Fall FY09 Vendor Maintenance.mdb")
Set rstDate = db.OpenRecordset("MasterTbl")
For Each varItem In ctl.ItemsSelected
strSQL = "DELETE * FROM [MasterTbl] IN 'F:\Vendor Matrix\Data\Source\
Maintenance Database - F09\MENS Fall FY09 Vendor Maintenance.mdb'" & _
" WHERE [Department #] = " & ctl.ItemData(varItem) & ""
DoCmd.RunSQL strSQL
Next varItem
Else
End If
DoCmd.Quit
End Sub