create recordset using ADO

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello I am trying to create and populate a recordset using ADO. Here is my
code:

Dim dbcurr As ADODB.Connection
Dim rstCurr As ADODB.Recordset

Set dbcurr = CurrentProject.Connection
Set rstCurr = New ADODB.Recordset


With rstCurr
..Fields.Append "From", adVariant
..Fields.Append "Date Sent", adDate
..Fields.Append "Subject", adVariant
..Fields.Append "Attachment_number", adInteger
..Fields.Append "Attachment_name", adVariant
End With

rstCurr.Open
rstCurr.AddNew
rstCurr.Fields("From") = "from"
rstCurr.Fields("Date Sent") = "sent"
'rstCurr.Fields("Subject") = "subject"
rstCurr.Update


However, I get the following error:

Multi-step operation generated errors. Check each status value.
 
Hi Tom,

I'm not an expert with ADO but it seems that you are trying to assign a string value to a Date type field.

.Fields.Append "Date Sent", adDate
....

and then

rstCurr.Fields("Date Sent") = "sent"

better

.Fields.Append "Date Sent", adVariant

and then

rstCurr.Fields("Date Sent") = "sent"

(sorry for my english)

Saludos,
Juan M Afan de Ribera
http://www.mvp-access.com/juanmafan
m
 
Back
Top