I have a two tables:
Discrepancy, and Code
Discrepancy is a general database that has various information. One of its fields, type, is multi-valued and comes from the Code database.
Code has ID, Code, and Description.
Originally, I tried setting the field by using a string separated by semicolons:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("Discrepancy", dbOpenDynaset)
rs.AddNew
'rs![...] = ...
rs![Type] = "1;2;3"
'rs![...] = ...
rs.Update
rs.Close
Set db = Nothing
That didn't work, so I tried to create a function and set the type to that:
Private Function get_codes(ByRef rs As DAO.Recordset) As DAO.Recordset2
rs.MoveFirst
Set get_codes = rs![CodeChart_Code].Value
End Function
This function appears to work in order to get the codes, but when trying to set it, I get the error "Method 'Collect' of 'recordset2' failed. I have tried using this as a DAO.Recordset and a DAO.Recordset2, with the same issue.