I have a table with a field with the display control set to Combo Box and I have not been able to read or write to it using an OpenRecordSet. What would I have to do to modify to get these scenarios to work?
Sub TryToRead()
Set db = CurrentDb
Set rs = db.OpenRecordset("tbl", dbOpenDynaset)
x = rs!FieldName '<------Combo Box Field. x shows no info.
End Sub
Sub TryToWrite()
Set db = CurrentDb
Set rs = db.OpenRecordset("tbl", dbOpenDynaset)
With rs
.AddNew
rs!FieldName = "Test Value" '<------ Results in Run-time error 64224 Application-defined or object-defined error
.Update
End With
End Sub
I think I have what I need.
Sub Testing()
Set db = CurrentDb
Set rs = db.OpenRecordset("tbl", dbOpenDynaset)
MyStr = Array("Value1", "Value2")
Do Until rs.EOF = True
Set rs2 = rs!FieldName!Value
rs.Edit
For Each c In MyStr
rs2.AddNew
rs2!Value.Value = c
rs2.Update
Next c
rs.Update
rs.MoveNext
Loop
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.