R
Ray C
I have a utility that gets some parameters passed to it and sets the Bookmark
in a form's record set.
Public Function util_Populate(frm As Form, strField As String, varInfo As
Variant, _
intType As Integer) As Boolean
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
End Function
This utility works fine when working with a form that is based on a Table
but does not work when I try to use it on a Form that is based on a Query (it
does not find the required information (even when I know it exists) and
always returns False. Is there some kind of restriction when working with
Forms based on Queries?
In this instance frm is "frm_Stock" (the Form that is basedon a Query),
strField is the field "SerialNo" varinfo is the record to be found (say
serial No "1234") and intType is 2 to indicate that the infomation to be
searched for is String information.
What I am wanting to acheive is to find a record based on the content of am
Unbound "Find" Box and display the record that is set by the Utility above.
Thanks for any help
RayC
in a form's record set.
Public Function util_Populate(frm As Form, strField As String, varInfo As
Variant, _
intType As Integer) As Boolean
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
End Function
This utility works fine when working with a form that is based on a Table
but does not work when I try to use it on a Form that is based on a Query (it
does not find the required information (even when I know it exists) and
always returns False. Is there some kind of restriction when working with
Forms based on Queries?
In this instance frm is "frm_Stock" (the Form that is basedon a Query),
strField is the field "SerialNo" varinfo is the record to be found (say
serial No "1234") and intType is 2 to indicate that the infomation to be
searched for is String information.
What I am wanting to acheive is to find a record based on the content of am
Unbound "Find" Box and display the record that is set by the Utility above.
Thanks for any help
RayC