L
Lorenzo Bolognini
Hi all,
i need to detect whether a field is required or not. I'm using this code for
building a string to convert later to an array (by Split) of which each
element matches the field index (ex. Field(myArray(0)):
For Each Field in rst.Fields
If Field.Attributes And adFldIsNullable Then
Required = 0 'field is NOT required
Else
Required = 1 'field is required
End If
strFieldRequired = strFieldRequired & Required & " "
Next
I'm running the above code against a table which has 4 fields in this exact
order:
- a PK
- 2 required text fields
- 1 NOT required text field
And i'm getting this result when printing strFieldRequired:
1 0 0 0
So what's the problem with the code above? I've got some inspiration from
the script at this URL:
http://www.asptechniques.com/content.asp?a=co&cID=910
Thank You,
Lorenzo
i need to detect whether a field is required or not. I'm using this code for
building a string to convert later to an array (by Split) of which each
element matches the field index (ex. Field(myArray(0)):
For Each Field in rst.Fields
If Field.Attributes And adFldIsNullable Then
Required = 0 'field is NOT required
Else
Required = 1 'field is required
End If
strFieldRequired = strFieldRequired & Required & " "
Next
I'm running the above code against a table which has 4 fields in this exact
order:
- a PK
- 2 required text fields
- 1 NOT required text field
And i'm getting this result when printing strFieldRequired:
1 0 0 0
So what's the problem with the code above? I've got some inspiration from
the script at this URL:
http://www.asptechniques.com/content.asp?a=co&cID=910
Thank You,
Lorenzo