Hi, i am using the function below to determine several properties of
each field in a recordset and all is working well. My problem is that I
dont know how to find the default value of a field. Does anyone have
any code suggestions that would get me the default value
For Each F In rstProgressData.Fields
If F.Type <> adChapter Then
If F.Name <> "upsize_ts" Then
rstDest.AddNew
rstDest!Progress = F.Name
Select Case F.Type
Case adChar, adVarWChar, adVarChar
rstDest!ProgressFieldType = "String"
rstDest!ProgressFieldSize = F.DefinedSize
Case adBoolean
rstDest!ProgressFieldType = "Boolean"
Case adSmallInt, adUnsignedTinyInt, adInteger
rstDest!ProgressFieldType = "Integer"
Case adDecimal, adNumeric
rstDest!ProgressFieldType = "Decimal"
Case adDBTimeStamp
rstDest!ProgressFieldType = "DateTime"
Case 203
rstDest!ProgressFieldType = "Memo"
End Select
If (F.Attributes And adFldIsNullable) = adFldIsNullable Then
rstDest!ProgressFieldNullable = True
End If
rstDest.Update
End If
End If
Next F
Paul Clement - 28 Nov 2005 13:50 GMT
¤ Hi, i am using the function below to determine several properties of
¤ each field in a recordset and all is working well. My problem is that I
¤ dont know how to find the default value of a field. Does anyone have
¤ any code suggestions that would get me the default value
¤
What type of database are you working with?
Paul
~~~~
Microsoft MVP (Visual Basic)
pol_c@tiscali.co.uk - 28 Nov 2005 16:47 GMT
Hi Paul, I'm using a sql server database and pass a recordset into this
function. i had hoped that there would a property like F.DefaultValue
but unfortunately not.
Paul Clement - 28 Nov 2005 18:39 GMT
¤ Hi Paul, I'm using a sql server database and pass a recordset into this
¤ function. i had hoped that there would a property like F.DefaultValue
¤ but unfortunately not.
Not in a Recordset based upon a SQL query, no. You probably would have to look at the table/column
schema in order to determine what this value is.
Paul
~~~~
Microsoft MVP (Visual Basic)