R
Ray C
I use the following to find a record and set the Bookmark in a Forms
Recordset. This should set all of the Fields that are displayed in my form to
the appropriate record. I use this Utility in other parts of my code and it
seems to work well. All the variables are passed to it from the calling
routine.
If intType = 1 Then strCriteria = BuildCriteria(strField, dbInteger, varInfo)
If intType = 2 Then strCriteria = BuildCriteria(strField, dbText, varInfo)
With frm.RecordsetClone
.FindFirst strCriteria
If Not .NoMatch Then
frm.Bookmark = .Bookmark
util_Populate = True
Else
util_Populate = False
End If
End With
The problem is that (in this particulsr scenario) it does not work and I can
not figure out what I am doing wrong.
My Table is a "Stock" table and the Serial number Fieild is a "String"
Field. I have various Serial Numbers stored in that Fielad and whilst some
are Numeric and some are Alpha Numeric, they are all stores as a String
Field. I therefore Call the routine with "intType" set to 2 (String) and
"varInfo" set the Serial Numberthat I want to find.
If I set Varinfo to "12ABC34" the criterion is ("SerialNo = "12ABC34") and
the record is found (the function returns True).
If I set Varinfo to "12ABC34" the criterion is ("SerialNo = "1234") and the
record is not found (the function returns False.
Both the records are definately in the Table but the Function seems to
discriminate between a Serial Number Field that contains data with Alpha
Characters in it and a Serial Number Field that contains data does not have
Alpha Characters in it even though they are all stored as strings.
Incidentally. If I pass "1234" to the function and deliberately tell it that
the variable being passed id a Number ( intType = 1) I get a "Type missmatch
error as would be expected.
Can anyone throw any light on what is happening here and what I should be
doing to correct it?
Thanks for any help Ray C
Recordset. This should set all of the Fields that are displayed in my form to
the appropriate record. I use this Utility in other parts of my code and it
seems to work well. All the variables are passed to it from the calling
routine.
If intType = 1 Then strCriteria = BuildCriteria(strField, dbInteger, varInfo)
If intType = 2 Then strCriteria = BuildCriteria(strField, dbText, varInfo)
With frm.RecordsetClone
.FindFirst strCriteria
If Not .NoMatch Then
frm.Bookmark = .Bookmark
util_Populate = True
Else
util_Populate = False
End If
End With
The problem is that (in this particulsr scenario) it does not work and I can
not figure out what I am doing wrong.
My Table is a "Stock" table and the Serial number Fieild is a "String"
Field. I have various Serial Numbers stored in that Fielad and whilst some
are Numeric and some are Alpha Numeric, they are all stores as a String
Field. I therefore Call the routine with "intType" set to 2 (String) and
"varInfo" set the Serial Numberthat I want to find.
If I set Varinfo to "12ABC34" the criterion is ("SerialNo = "12ABC34") and
the record is found (the function returns True).
If I set Varinfo to "12ABC34" the criterion is ("SerialNo = "1234") and the
record is not found (the function returns False.
Both the records are definately in the Table but the Function seems to
discriminate between a Serial Number Field that contains data with Alpha
Characters in it and a Serial Number Field that contains data does not have
Alpha Characters in it even though they are all stored as strings.
Incidentally. If I pass "1234" to the function and deliberately tell it that
the variable being passed id a Number ( intType = 1) I get a "Type missmatch
error as would be expected.
Can anyone throw any light on what is happening here and what I should be
doing to correct it?
Thanks for any help Ray C