gray
08-20-2007, 10:37 AM
Hi
Access 2002
WinXP Pro
I'm having trouble declaring a recordset in the code for a form. I've searched the forums for "fields.append" but without success. Could someone help me please? I get various errors on the declarations below, the latest being an error on the second field, "project" i.e. :-
"Runtime error 3001",
"Arguments are of the wrong type, are out of acceptable range or are in conflict with one another"
I've tried various permutations of RS declarations but clearly I am missing something obvious. It seems to be linked with the "ad" type.
----------------------------------------------
Dim RS As New ADODB.Recordset
' Declare the RS fields
RS.Fields.Append "Sched_Id", adInteger
RS.Fields.Append "Project", adChar
RS.Fields.Append "Number", adInteger
RS.Fields.Append "Quantity", adInteger
RS.Fields.Append "Item_Cost", adDouble
RS.Fields.Append "Item_Tax_Rating", adDouble
RS.Fields.Append "Date_Item_Added", adDate
---------------------------------------------------------
Thanks for any assistance.....
Hi - Update - I've fixed it thanks - for those getting caught out, what appears to be an optional parameter isn't ... the adChar has to be followed by a size ... i.e.
RS.Fields.Append "Project", adChar, 128 or whatever
Rgds
Access 2002
WinXP Pro
I'm having trouble declaring a recordset in the code for a form. I've searched the forums for "fields.append" but without success. Could someone help me please? I get various errors on the declarations below, the latest being an error on the second field, "project" i.e. :-
"Runtime error 3001",
"Arguments are of the wrong type, are out of acceptable range or are in conflict with one another"
I've tried various permutations of RS declarations but clearly I am missing something obvious. It seems to be linked with the "ad" type.
----------------------------------------------
Dim RS As New ADODB.Recordset
' Declare the RS fields
RS.Fields.Append "Sched_Id", adInteger
RS.Fields.Append "Project", adChar
RS.Fields.Append "Number", adInteger
RS.Fields.Append "Quantity", adInteger
RS.Fields.Append "Item_Cost", adDouble
RS.Fields.Append "Item_Tax_Rating", adDouble
RS.Fields.Append "Date_Item_Added", adDate
---------------------------------------------------------
Thanks for any assistance.....
Hi - Update - I've fixed it thanks - for those getting caught out, what appears to be an optional parameter isn't ... the adChar has to be followed by a size ... i.e.
RS.Fields.Append "Project", adChar, 128 or whatever
Rgds