J
jonefer
I have a main form with a combobox called cmbSearchField
It is used to see if the value in the combo box exists in any of the records
in
qryResults
There is a non-linked subform on the form called:
SearchAll_subform
whose recordsource is qrySearchAll (it just grabs all the fields from
qryResults and filters it with either -ALL or whatever is selected in the
cmbSearch field)
I was able to get this code to work with a listbox... but now I'm trying a
subform and the subform just won't refresh no matter what i try.
I'm using Access 97 because the user only has 97. I know I wouldn't have
this problem in XP or 2003.
any ideas?
Note: this application is a utility for finding fields that are used in
reports. So it may seem confusing when you see 'field' or 'table'..
consider 'field' or 'table' just like 'apple' or 'orange'
Here's my code that takes place in the AfterUpdate event of the combobox.
'====================================
Private Sub cmbSearchField_AfterUpdate()
Dim strQry As String
Dim strQryFltr As String
Dim qdf As DAO.QueryDef
Dim rs As DAO.Recordset
Dim db As DAO.Database
strQry = "SELECT R_ID, " & _
"ReportID AS [Report ID], " & _
"RootDir, " & _
"SubDir, " & _
"RptDescr AS Description, " & _
"TableName AS [Table Name], " & _
"FieldName AS [Field Name] " & _
"FROM qryAllResults;"
strQryFltr = "SELECT R_ID, " & _
"ReportID AS [Report ID], " & _
"RootDir, " & _
"SubDir, " & _
"RptDescr AS Description, " & _
"TableName AS [Table Name], " & _
"FieldName AS [Field Name] " & _
"FROM qryAllResults WHERE FieldName = '" & Me.cmbSearchField & "';"
Set db = CurrentDb
Set qdf = db.QueryDefs("qrySearchAll")
Select Case Me.cmbSearchField.Value
Case "*ALL"
qdf.SQL = strQry
db.QueryDefs.Refresh
Call Form_Current 'current event says: [SearchAll_Subform].requery
Me.SearchAll_subform.Form.Requery
Case Else
qdf.SQL = strQryFltr
db.QueryDefs.Refresh
Call Form_Current 'current event says: [SearchAll_Subform].requery
Me.SearchAll_subform.Form.Requery
End Select
Set qdf = Nothing
Set db = Nothing
End Sub
It is used to see if the value in the combo box exists in any of the records
in
qryResults
There is a non-linked subform on the form called:
SearchAll_subform
whose recordsource is qrySearchAll (it just grabs all the fields from
qryResults and filters it with either -ALL or whatever is selected in the
cmbSearch field)
I was able to get this code to work with a listbox... but now I'm trying a
subform and the subform just won't refresh no matter what i try.
I'm using Access 97 because the user only has 97. I know I wouldn't have
this problem in XP or 2003.
any ideas?
Note: this application is a utility for finding fields that are used in
reports. So it may seem confusing when you see 'field' or 'table'..
consider 'field' or 'table' just like 'apple' or 'orange'
Here's my code that takes place in the AfterUpdate event of the combobox.
'====================================
Private Sub cmbSearchField_AfterUpdate()
Dim strQry As String
Dim strQryFltr As String
Dim qdf As DAO.QueryDef
Dim rs As DAO.Recordset
Dim db As DAO.Database
strQry = "SELECT R_ID, " & _
"ReportID AS [Report ID], " & _
"RootDir, " & _
"SubDir, " & _
"RptDescr AS Description, " & _
"TableName AS [Table Name], " & _
"FieldName AS [Field Name] " & _
"FROM qryAllResults;"
strQryFltr = "SELECT R_ID, " & _
"ReportID AS [Report ID], " & _
"RootDir, " & _
"SubDir, " & _
"RptDescr AS Description, " & _
"TableName AS [Table Name], " & _
"FieldName AS [Field Name] " & _
"FROM qryAllResults WHERE FieldName = '" & Me.cmbSearchField & "';"
Set db = CurrentDb
Set qdf = db.QueryDefs("qrySearchAll")
Select Case Me.cmbSearchField.Value
Case "*ALL"
qdf.SQL = strQry
db.QueryDefs.Refresh
Call Form_Current 'current event says: [SearchAll_Subform].requery
Me.SearchAll_subform.Form.Requery
Case Else
qdf.SQL = strQryFltr
db.QueryDefs.Refresh
Call Form_Current 'current event says: [SearchAll_Subform].requery
Me.SearchAll_subform.Form.Requery
End Select
Set qdf = Nothing
Set db = Nothing
End Sub