July 1, 2008 at 7:39 am
It appears that in any ADODB Recordset for MS Access 2003, based on a table within Access, any Yes/No type field cannot be referred to by name with code like:
rs.Fields("MY_YES_NO_FIELD")
Apparently, you can only use the ordinal position of that field within the database. I'm wondering if this is related to the difficulty associated with possible 3-state logic? (NULL, Yes, or No)
Other than transforming those fields to 1 byte text fields, is there any fix for this, or are we stuck with it? It sure makes code look like crap.
Steve
(aka smunson)
:):):)
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
August 11, 2008 at 3:08 pm
both of these worked for me:
Public Function AdoYesNo()
Dim rs As New ADODB.Recordset
rs.Open "tbl2", CurrentProject.Connection, _
adOpenKeyset, adLockOptimistic
rs.MoveFirst
Debug.Print rs.RecordCount
Do While Not rs.EOF
Debug.Print rs.Fields("tbl2YesNo")
Debug.Print rs("tbl2YesNo")
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Function
August 11, 2008 at 3:40 pm
Unfortunately, that's not the result I end up with. I'm unable to refer to any Yes/No field by name. I've long ago given up on using such fields within Access, and instead I just use a 1 byte text field, limiting it's values as appropriate.
Steve
(aka smunson)
:):):)
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply