P
pkihou
I am trying to populate the different columns, with different vales;
following script is not doing what I need to do. Can some one help me? Thanks
Dim frm As Form, ctl As ListBox
Dim varItem As Variant
Dim strSQL1 As String
Dim db As DAO.Database
Set db = CurrentDb
Set frm = Forms!CreateComplianceReport
Set ctl = frm!ASQARep
'Assuming long [EmpID] is the bound field in lb
'enumerate selected items and
'concatenate to strSQL
If ctl.MultiSelect > 0 Then
If ctl.ItemsSelected.Count > 0 Then
For Each varItem In ctl.ItemsSelected
strSQL = "INSERT INTO ComplianceReport (ASQARep1,ASQARep2) VALUES ('" &
ctl.Column(ASQARep1, varItem) & "','" & ctl.Column(ASQARep2, varItem) & "');"
db.Execute strSQL
Next varItem
End If
End If
Set ctl = Nothing
Set frm = Nothing
Set db = Nothing
following script is not doing what I need to do. Can some one help me? Thanks
Dim frm As Form, ctl As ListBox
Dim varItem As Variant
Dim strSQL1 As String
Dim db As DAO.Database
Set db = CurrentDb
Set frm = Forms!CreateComplianceReport
Set ctl = frm!ASQARep
'Assuming long [EmpID] is the bound field in lb
'enumerate selected items and
'concatenate to strSQL
If ctl.MultiSelect > 0 Then
If ctl.ItemsSelected.Count > 0 Then
For Each varItem In ctl.ItemsSelected
strSQL = "INSERT INTO ComplianceReport (ASQARep1,ASQARep2) VALUES ('" &
ctl.Column(ASQARep1, varItem) & "','" & ctl.Column(ASQARep2, varItem) & "');"
db.Execute strSQL
Next varItem
End If
End If
Set ctl = Nothing
Set frm = Nothing
Set db = Nothing