B
bigwillno2 via AccessMonster.com
Hello, i am trying to add items from a listbox called MyList into a table
called MSM. This listbox contains query with unmatching items between MSM and
LinkedTable.
fields in MSM are ModelNumber(text), Desc, SpringID, BorderID etc......
fields in LinkedTable are ID_1, OrderNo, Comment.
the fields that are being compared are, ModelNumber and ID_1 the are similar
data. over a click, this is what i have:
Private Sub addParts_Click()
Dim varItem As Variant
Dim db As DAO.Database, rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("MSM", dbOpenDynaset)
For Each varItem In Me.MyList.ItemsSelected
With rst
.AddNew
!ID_1 = Me.MyList(varItem)
.update
End With
Next
rst.close
Set rst = Nothing
Set db = Nothing
End Sub
this code gives me an unmatching datatype and pointing at this line: !ID_1 =
Me.MyList(varItem)
my question is where is my systax wrong and how can i flag or get rid of the
items once they already added into the table.
called MSM. This listbox contains query with unmatching items between MSM and
LinkedTable.
fields in MSM are ModelNumber(text), Desc, SpringID, BorderID etc......
fields in LinkedTable are ID_1, OrderNo, Comment.
the fields that are being compared are, ModelNumber and ID_1 the are similar
data. over a click, this is what i have:
Private Sub addParts_Click()
Dim varItem As Variant
Dim db As DAO.Database, rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("MSM", dbOpenDynaset)
For Each varItem In Me.MyList.ItemsSelected
With rst
.AddNew
!ID_1 = Me.MyList(varItem)
.update
End With
Next
rst.close
Set rst = Nothing
Set db = Nothing
End Sub
this code gives me an unmatching datatype and pointing at this line: !ID_1 =
Me.MyList(varItem)
my question is where is my systax wrong and how can i flag or get rid of the
items once they already added into the table.