Hi,
I have a filter sub that has worked perfectly fine in Windows XP, but will not work when used in Windows 7. The database is in 2003 format.
Basically, I have a text box in the form header (frmStockInfo). When you type in a keyword and press enter, it searches the table "tblStocklist". It then brings all the records which have this keyword in them and places them in a sub form (subfrmStockInfoStock).
What does windows 7 do differently to windows XP? I am using Access 2003 on both operating systems.
here is my code:
'code to search table tblStockList
Private Sub FilterSub()
SISFSto
Form_frmStockInfo.subfrmStockInfo.Form.RecordSource = "SELECT tblStockList.SRN, tblStockList.[Part Description], tblStockList.[Type/Mat'l] AS TypeMaterial, tblStockList.Spec, tblStockList.[Size-type], tblStockList.Tolerances, tblStockList.PartTypeID, tblStockList.SupplierID, tblStocklist.UOM, tblstocklist.pstatus, tblstocklist.cstatus, tblStockList.Total FROM tblStockList WHERE (((tblStockList.[Part Description]) like '*" & cboFindRecords & "*')) OR (((tblStockList.[Type/Mat'l]) like '*" & cboFindRecords & "*')) OR (((tblStockList.Spec) like '*" & cboFindRecords & "*')) OR (((tblStockList.[Size-type]) like '*" & cboFindRecords & "*'));"
End Sub
--------------------------------------
'code to list results in subform "subfrmStockInfoStock"
Function SISFSto()
Call SISetSubForm("subfrmStockInfoStock", "", "", "Stock List")
End Function
Function SISetSubForm(strSourceObject As String, strChildField As String, strMasterField As String, strCaption As String)
With Form_frmStockInfo.subfrmStockInfo
.SourceObject = "subfrmStockInfoLoad"
.LinkMasterFields = ""
.LinkChildFields = ""
End With
With Form_frmStockInfo.subfrmStockInfo
.SourceObject = strSourceObject
.LinkMasterFields = strMasterField
.LinkChildFields = strChildField
End With
Form_frmStockInfo.lblsubfrm.Caption = strCaption
End Function
I have a filter sub that has worked perfectly fine in Windows XP, but will not work when used in Windows 7. The database is in 2003 format.
Basically, I have a text box in the form header (frmStockInfo). When you type in a keyword and press enter, it searches the table "tblStocklist". It then brings all the records which have this keyword in them and places them in a sub form (subfrmStockInfoStock).
What does windows 7 do differently to windows XP? I am using Access 2003 on both operating systems.
here is my code:
'code to search table tblStockList
Private Sub FilterSub()
SISFSto
Form_frmStockInfo.subfrmStockInfo.Form.RecordSource = "SELECT tblStockList.SRN, tblStockList.[Part Description], tblStockList.[Type/Mat'l] AS TypeMaterial, tblStockList.Spec, tblStockList.[Size-type], tblStockList.Tolerances, tblStockList.PartTypeID, tblStockList.SupplierID, tblStocklist.UOM, tblstocklist.pstatus, tblstocklist.cstatus, tblStockList.Total FROM tblStockList WHERE (((tblStockList.[Part Description]) like '*" & cboFindRecords & "*')) OR (((tblStockList.[Type/Mat'l]) like '*" & cboFindRecords & "*')) OR (((tblStockList.Spec) like '*" & cboFindRecords & "*')) OR (((tblStockList.[Size-type]) like '*" & cboFindRecords & "*'));"
End Sub
--------------------------------------
'code to list results in subform "subfrmStockInfoStock"
Function SISFSto()
Call SISetSubForm("subfrmStockInfoStock", "", "", "Stock List")
End Function
Function SISetSubForm(strSourceObject As String, strChildField As String, strMasterField As String, strCaption As String)
With Form_frmStockInfo.subfrmStockInfo
.SourceObject = "subfrmStockInfoLoad"
.LinkMasterFields = ""
.LinkChildFields = ""
End With
With Form_frmStockInfo.subfrmStockInfo
.SourceObject = strSourceObject
.LinkMasterFields = strMasterField
.LinkChildFields = strChildField
End With
Form_frmStockInfo.lblsubfrm.Caption = strCaption
End Function