Reggaefloww
Programmer
The error is occuring on a Microsoft Access database where Microsoft Access is both the front end and back end. The tables in the Microsoft Access front end is being relinked every time the front end is opening. However, the specified library it is referring to is the name of the database. Can the database be referenced and how?
The code that this occurs in is code I am using to hide and unhide certain columns on a Microsoft Access subform. Any help will be much appreciated.
Public Function SortSubform()
'On Error GoTo Err_Handler
Dim qDef As Object
Dim strSql As String
Dim vItem As Variant
Dim NumFields As Integer
Dim intCounter As Integer
NumFields = 0
' loop through selected field names
For Each vItem In Me.lstFieldList.ItemsSelected
strSql = strSql & ",[" & Me.lstFieldList.ItemData(vItem) & "]"
NumFields = NumFields + 1
Next vItem
For intCounter = 0 To lstFieldList.ListCount - 1
Me.subformCertData.Form.Controls(lstFieldList.ItemData(intCounter)).ColumnHidden = Not (lstFieldList.Selected(intCounter))
For Each vItem In Me.lstFieldList.ItemsSelected
Me.subformCertData.Form.Controls(lstFieldList.ItemData(intCounter)).ColumnHidden = Not (lstFieldList.Selected(intCounter))
Next vItem
Next intCounter
' build new StrSQL statement
strSql = "Select * " & _
"FROM tblCertificationData"
' add criteria for selected fields.
Strfield = "ReceivedDate"
strSql = strSql & " WHERE ((([ProcurementNumber]) Like [Forms]![frmSearch]![txtProcurementNumber]) And (([ReceivedDate]) Between [Forms]![frmSearch]![txtStartDate] And [Forms]![frmSearch]![txtEndDate]) AND (Isnull(PurchaseOrderNum) or ([PurchaseOrderNum]) Like [Forms]![frmSearch]![PONum]) And (([ReceivedBy]) Like [Forms]![frmSearch]![cboAnalystID]) AND (([EquipmentType]) Like [Forms]![frmSearch]![cboEquipmentType]) AND (([DistrictNumber]) Like [Forms]![frmSearch]![cboDistrict]))" & _
" Order by [ProcurementNumber];"
' save query with new StrSQL statement
Set qDef = CurrentDb.QueryDefs("qryProjectCriteria")
qDef.SQL = strSql
Set qDef = Nothing
Me.subformCertData.Form.RecordSource = strSql
' Set Recordsource of Subform
'Me.SearchLst.ColumnCount = NumFields
Exit_Err_Handler:
Exit Function
Err_Handler:
MsgBox Err.Description
Resume Exit_Err_Handler
End Function
The code that this occurs in is code I am using to hide and unhide certain columns on a Microsoft Access subform. Any help will be much appreciated.
Public Function SortSubform()
'On Error GoTo Err_Handler
Dim qDef As Object
Dim strSql As String
Dim vItem As Variant
Dim NumFields As Integer
Dim intCounter As Integer
NumFields = 0
' loop through selected field names
For Each vItem In Me.lstFieldList.ItemsSelected
strSql = strSql & ",[" & Me.lstFieldList.ItemData(vItem) & "]"
NumFields = NumFields + 1
Next vItem
For intCounter = 0 To lstFieldList.ListCount - 1
Me.subformCertData.Form.Controls(lstFieldList.ItemData(intCounter)).ColumnHidden = Not (lstFieldList.Selected(intCounter))
For Each vItem In Me.lstFieldList.ItemsSelected
Me.subformCertData.Form.Controls(lstFieldList.ItemData(intCounter)).ColumnHidden = Not (lstFieldList.Selected(intCounter))
Next vItem
Next intCounter
' build new StrSQL statement
strSql = "Select * " & _
"FROM tblCertificationData"
' add criteria for selected fields.
Strfield = "ReceivedDate"
strSql = strSql & " WHERE ((([ProcurementNumber]) Like [Forms]![frmSearch]![txtProcurementNumber]) And (([ReceivedDate]) Between [Forms]![frmSearch]![txtStartDate] And [Forms]![frmSearch]![txtEndDate]) AND (Isnull(PurchaseOrderNum) or ([PurchaseOrderNum]) Like [Forms]![frmSearch]![PONum]) And (([ReceivedBy]) Like [Forms]![frmSearch]![cboAnalystID]) AND (([EquipmentType]) Like [Forms]![frmSearch]![cboEquipmentType]) AND (([DistrictNumber]) Like [Forms]![frmSearch]![cboDistrict]))" & _
" Order by [ProcurementNumber];"
' save query with new StrSQL statement
Set qDef = CurrentDb.QueryDefs("qryProjectCriteria")
qDef.SQL = strSql
Set qDef = Nothing
Me.subformCertData.Form.RecordSource = strSql
' Set Recordsource of Subform
'Me.SearchLst.ColumnCount = NumFields
Exit_Err_Handler:
Exit Function
Err_Handler:
MsgBox Err.Description
Resume Exit_Err_Handler
End Function