Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Default Values To Recordset Fields

Status
Not open for further replies.

BenSCooper

Programmer
Sep 28, 2009
15
GB
Dear All,
I have an ADO recordset in the format (TableName, FieldName, DataType, MaxLength, DefaultValue)

I am trying to construct an ADO recordset object from this in the following format:
Name: Field1 Value: Default1
Name: Field2 Value: Default2

The purpose behind this is to get the table structure from SQL Server in recordset1 and then construct the second recordset so I can enter data into it and pass it back to my data access function without having to pass 101 parameters.

I've tried the following code:
Dim rst As New ADODB.Recordset

rst.Fields.Append "Field1", [DataType] (e.g. advarchar), [MaxLength], , [DefaultValue]

However, no matter what I seem to try I always get the error "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another" whenever I pass a default value that isn't Null.

Advice would be gratefully received as I really need the default values included in this solution.

Thanks in advance
Ben Cooper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top