C
CEJ
In Access 2002, I have a form with a subform on it that I want to have
display the results of a SQL query on an Access table. The query allows for
an inexact search based on the contents of a text field on the parent form.
In the code listed below,
the query runs correctly and successfully builds the recordset, but after I
set the
subform's record source to the query and issue the requery command for the
subform, the records do not display in the subform control. Any thoughts on
what
the problem might be?
Dim stNameLast As String
Dim stSQL As String
Dim rst As New ADODB.Recordset
stNameLast = Me.txtSrchNameLast
stSQL = "SELECT UserID, NameLast, NameFirst FROM tblUsers " & _
"WHERE (NameLast Like '" & stNameLast & "%')"
rst.Open stSQL, CurrentProject.Connection, adOpenStatic, adLockReadOnly,
adCmdText
Me.ctrlUserSearchSubform.Form.RecordSource = stSQL
Me.ctrlUserSearchSubform.Form.Requery
display the results of a SQL query on an Access table. The query allows for
an inexact search based on the contents of a text field on the parent form.
In the code listed below,
the query runs correctly and successfully builds the recordset, but after I
set the
subform's record source to the query and issue the requery command for the
subform, the records do not display in the subform control. Any thoughts on
what
the problem might be?
Dim stNameLast As String
Dim stSQL As String
Dim rst As New ADODB.Recordset
stNameLast = Me.txtSrchNameLast
stSQL = "SELECT UserID, NameLast, NameFirst FROM tblUsers " & _
"WHERE (NameLast Like '" & stNameLast & "%')"
rst.Open stSQL, CurrentProject.Connection, adOpenStatic, adLockReadOnly,
adCmdText
Me.ctrlUserSearchSubform.Form.RecordSource = stSQL
Me.ctrlUserSearchSubform.Form.Requery