G
Guest
Hello everyone,
I'm using a shared access database on our network. All users but 1 can use
it without error. The other user was fine yesterday, but today gets an error
"error in loading DLL" error # 48, source pitrack. Pitrack is the name of
the database.
I have the following references setup in this order:
visual basic for applications
ms access 10.0 object library
ole automation
ms dao 3.6 object library
ms activex data objects 2.5 library
The code that causes the error is using DAO and is listed below.
all machines are using the Access runtime 10.0.2627.1
Can anyone help me narrow down this problem? I now from past experience
that reinstalling the runtime will fix the problem, but this has happened a
few times now on several different computers, so I would like to find the
source of the problem.
thank you
----- code here that causes error ----- I do not know which line is
erroring out ---
On Error GoTo error_handler
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim PID As Long
Dim fileNumber As String
Dim sqlString As String
Set db = CurrentDb()
Dim dbs As DAO.Database
Dim qdf As DAO.querydef
Set dbs = CurrentDb()
If txtID = "" Or IsNull(txtID) Then
Exit Sub
End If
'--------------------------------------------
' find the PID (project id) using module1 function
PID = PropertyID(txtID)
If PID < 0 Then
'error occured, was not found
MsgBox "Error PID not found"
Exit Sub
End If
'------------------------------------------------
' project
'
'generate sql for project
sqlString = "SELECT active_property.property_id,
active_property.servicing_site_name_text,active_property.property_name_text,
active_property.address_line1_text, active_property.address_line2_text, " & _
"active_property.city_name_text, active_property.state_code,
active_property.zip_code, active_property.county_name_text,
active_property.property_on_site_phone_number,
active_property.primary_fha_number, " & _
"active_property.associated_fha_number,
active_property.associated_contract_number,
active_property.project_manager_name_text,active_property.total_assisted_unit_count, active_property.total_unit_count, " & _
"active_property.congressional_district_code,
active_property.primary_financing_type, active_property.is_afs_required_ind,
active_property.afs_fiscal_yr_end_date, active_property.client_group_type " &
_
"FROM active_property " & _
"WHERE (((active_property.property_id)= " & PID & "))"
'---------------------------------------
' create the Query for the report
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryProject" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryProject", sqlString)
Forms!frmPIR_3.RecordSource = "qryProject"
'------------------------------------------------------------
' management agent contact
'
'
sqlString = "SELECT DISTINCT active_property.property_id,
active_property_participant.mgmt_contact_full_name,
active_property_participant.mgmt_contact_address_line1, " & _
"active_property_participant.mgmt_contact_address_line2,
active_property_participant.mgmt_contact_city_name,
active_property_participant.mgmt_contact_state_code, " & _
"active_property_participant.mgmt_contact_zip_code,
active_property_participant.mgmt_contact_main_phn_nbr,
active_property_participant.mgmt_contact_main_fax_nbr,
active_property_participant.mgmt_contact_email_text " & _
"FROM active_property INNER JOIN active_property_participant ON
active_property.property_id = active_property_participant.property_id " & _
"WHERE (((active_property.property_id)= " & PID & "))"
'---------------------------------------
' create the Query for the report
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryManagementAgentContact" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryManagementAgentContact", sqlString)
Forms!frmPIR_3.[frmManagementAgentContact].Form.RecordSource =
"qryManagementAgentContact"
'-------------------------------------------------------------------
' management agent
'
sqlString = "SELECT DISTINCT active_property.property_id,
active_property_participant.mgmt_agent_org_name,
active_property_participant.mgmt_agent_address_line1,
active_property_participant.mgmt_agent_address_line2,
active_property_participant.mgmt_agent_city_name,
active_property_participant.mgmt_agent_state_code,
active_property_participant.mgmt_agent_zip_code,
active_property_participant.mgmt_agent_main_phone_number,
active_property_participant.mgmt_agent_main_fax_number,
active_property_participant.mgmt_agent_email_text " & _
"FROM active_property INNER JOIN active_property_participant ON
active_property.property_id = active_property_participant.property_id " & _
"WHERE (((active_property.property_id)=" & PID & "))"
'------------------------------------------------------------
' management agent
' create the Query for the report
'
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryManagement" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryManagement", sqlString)
'DoCmd.OpenQuery qdf.Name
Forms![frmPIR_3].[frmManagement].Form.RecordSource = "qryManagement"
'------------------------------------------------------------
' property manager
'
sqlString = "SELECT DISTINCT active_property.property_id,
active_property_participant.mgmt_contact_full_name,
active_property_participant.mgmt_contact_address_line1,
active_property_participant.mgmt_contact_address_line2,
active_property_participant.mgmt_contact_city_name,
active_property_participant.mgmt_contact_state_code,
active_property_participant.mgmt_contact_zip_code,
active_property_participant.mgmt_contact_main_phn_nbr,
active_property_participant.mgmt_contact_main_fax_nbr,
active_property_participant.mgmt_contact_email_text " & _
"FROM active_property INNER JOIN active_property_participant ON
active_property.property_id = active_property_participant.property_id " & _
"WHERE (((active_property.property_id)=" & PID & "))"
'---------------------------------------
' create the Query for the report
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryPropertyManager" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryPropertyManager", sqlString)
Forms!frmPIR_3.[frmPropertyManager].Form.RecordSource =
"qryPropertyManager"
'-----------------------------------------------------
' owner section
'
sqlString = "SELECT DISTINCT active_property_participant.property_id,
active_property_participant.owner_organization_name,
active_property_participant.owner_address_line1,
active_property_participant.owner_address_line2,
active_property_participant.owner_city_name,
active_property_participant.owner_state_code,
active_property_participant.owner_zip_code,
active_property_participant.owner_main_phone_number_text,
active_property_participant.owner_main_fax_number_text,
active_property_participant.owner_email_text,
active_property_participant.owner_contact_indv_full_name,
active_property_participant.owner_contact_main_phone_num,
active_property_participant.owner_contact_main_fax_num,
active_property_participant.owner_contact_email_text " & _
"FROM active_property_participant " & _
"WHERE active_property_participant.property_id=" & PID
'---------------------------------------
' create the Query for the report
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryOwner" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryOwner", sqlString)
Forms![frmPIR_3]![frmOwner].Form.RecordSource = "qryOwner"
'-----------------------------------------------------
' mortgagee section
'
sqlString = "SELECT DISTINCT
active_property.property_id,financing_instrument.primary_loan_code,
hometab.institution_name, hometab.m_addr_line1, hometab.m_addr_line2,
hometab.m_city, hometab.m_state, hometab.m_zip1 " & _
"FROM (active_property INNER JOIN financing_instrument ON
active_property.property_id = financing_instrument.property_id) INNER JOIN
hometab ON financing_instrument.srvcr_mrtge_nbr = hometab.srvcr_mrtge_nbr " &
_
"WHERE (((active_property.property_id)= " & PID & ") AND
((financing_instrument.primary_loan_code)='1'))"
'---------------------------------------
' create the Query for the report
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryMortgagee" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryMortgagee", sqlString)
Forms![frmPIR_3]![frmMortgagee].Form.RecordSource = "qryMortgagee"
'-----------------------------------------------------
' Contract Administrator Contact
'
'---------------------------------------
' create the Query for the report
sqlString = "SELECT DISTINCT contract_contact.property_id,
contract_contact.contact_name, contract_contact.main_phone,
contract_contact.main_fax, contract_contact.email,
contract_contact.street_address, contract_contact.street2_address,
contract_contact.city, contract_contact.state, contract_contact.zip_code,
contract_contact.zip4_code " & _
"FROM contract_contact INNER JOIN contract_participant ON
contract_contact.contract_number=contract_participant.contract_number " & _
"WHERE (((contract_contact.property_id)=" & PID & "))"
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryContractAdminContact" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryContractAdminContact", sqlString)
Forms![frmPIR_3]![frmContractAdminContact].Form.RecordSource =
"qryContractAdminContact"
'-----------------------------------------------------
' Contract Administrator
'
'---------------------------------------
' create the Query for the report
sqlString = "SELECT DISTINCT active_property.property_id,
address.street_address, address.street2_address, address.city, address.state,
address.zip_code, address.zip4_code, address.county_name,
participant.indv_last_name, participant.indv_first_name,
participant.org_name, participant.main_phone, participant.main_fax,
participant.email " & _
"FROM ((active_property INNER JOIN contact_participant ON
active_property.property_id = contact_participant.property_id) INNER JOIN
participant ON contact_participant.participant_id =
participant.participant_id) INNER JOIN (participant_address INNER JOIN
address ON participant_address.address_id = address.address_id) ON
participant.participant_id = participant_address.participant_id " & _
"WHERE active_property.property_id = " & PID
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryContractAdmin" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryContractAdmin", sqlString)
Forms![frmPIR_3]![frmContractAdmin].Form.RecordSource = "qryContractAdmin"
'------------------------------------------------------------------------
' Financing_instrument section
'
'sqlString = "SELECT DISTINCT financing_instrument.property_id,
financing_instrument.primary_loan_code, financing_instrument.fha_number,
dbo_soa_reference.soa_nmrc_name, financing_instrument.final_endorsement_date,
financing_instrument.excess_inc_ind, financing_instrument.excess_inc_end_date
" & _
' "FROM financing_instrument INNER JOIN dbo_soa_reference ON
financing_instrument.section_code = dbo_soa_reference.section_code " & _
' "WHERE (((financing_instrument.property_id)=" & PID & "))"
'---------------------------------------
' create the Query for the report
'dbs.querydefs.Refresh
' If query exists, delete it.
'For Each qdf In dbs.querydefs
' If qdf.Name = "qryFinancingInstrument" Then
' dbs.querydefs.Delete qdf.Name
' End If
'Next qdf
'Set qdf = dbs.CreateQueryDef("qryFinancingInstrument", sqlString)
'Forms![frmPIR_3]![frmContractAdmin].Form.RecordSource =
"qryFinancingInstrument"
Exit Sub
error_handler:
'error occured error_handler
MsgBox "An Error Occured (frmPIR): " & Err.Description & _
(Chr(13)) & "error #: " & Err.Number & _
(Chr(13)) & "error source: " & Err.Source
Exit Sub
End Sub
I'm using a shared access database on our network. All users but 1 can use
it without error. The other user was fine yesterday, but today gets an error
"error in loading DLL" error # 48, source pitrack. Pitrack is the name of
the database.
I have the following references setup in this order:
visual basic for applications
ms access 10.0 object library
ole automation
ms dao 3.6 object library
ms activex data objects 2.5 library
The code that causes the error is using DAO and is listed below.
all machines are using the Access runtime 10.0.2627.1
Can anyone help me narrow down this problem? I now from past experience
that reinstalling the runtime will fix the problem, but this has happened a
few times now on several different computers, so I would like to find the
source of the problem.
thank you
----- code here that causes error ----- I do not know which line is
erroring out ---
On Error GoTo error_handler
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim PID As Long
Dim fileNumber As String
Dim sqlString As String
Set db = CurrentDb()
Dim dbs As DAO.Database
Dim qdf As DAO.querydef
Set dbs = CurrentDb()
If txtID = "" Or IsNull(txtID) Then
Exit Sub
End If
'--------------------------------------------
' find the PID (project id) using module1 function
PID = PropertyID(txtID)
If PID < 0 Then
'error occured, was not found
MsgBox "Error PID not found"
Exit Sub
End If
'------------------------------------------------
' project
'
'generate sql for project
sqlString = "SELECT active_property.property_id,
active_property.servicing_site_name_text,active_property.property_name_text,
active_property.address_line1_text, active_property.address_line2_text, " & _
"active_property.city_name_text, active_property.state_code,
active_property.zip_code, active_property.county_name_text,
active_property.property_on_site_phone_number,
active_property.primary_fha_number, " & _
"active_property.associated_fha_number,
active_property.associated_contract_number,
active_property.project_manager_name_text,active_property.total_assisted_unit_count, active_property.total_unit_count, " & _
"active_property.congressional_district_code,
active_property.primary_financing_type, active_property.is_afs_required_ind,
active_property.afs_fiscal_yr_end_date, active_property.client_group_type " &
_
"FROM active_property " & _
"WHERE (((active_property.property_id)= " & PID & "))"
'---------------------------------------
' create the Query for the report
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryProject" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryProject", sqlString)
Forms!frmPIR_3.RecordSource = "qryProject"
'------------------------------------------------------------
' management agent contact
'
'
sqlString = "SELECT DISTINCT active_property.property_id,
active_property_participant.mgmt_contact_full_name,
active_property_participant.mgmt_contact_address_line1, " & _
"active_property_participant.mgmt_contact_address_line2,
active_property_participant.mgmt_contact_city_name,
active_property_participant.mgmt_contact_state_code, " & _
"active_property_participant.mgmt_contact_zip_code,
active_property_participant.mgmt_contact_main_phn_nbr,
active_property_participant.mgmt_contact_main_fax_nbr,
active_property_participant.mgmt_contact_email_text " & _
"FROM active_property INNER JOIN active_property_participant ON
active_property.property_id = active_property_participant.property_id " & _
"WHERE (((active_property.property_id)= " & PID & "))"
'---------------------------------------
' create the Query for the report
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryManagementAgentContact" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryManagementAgentContact", sqlString)
Forms!frmPIR_3.[frmManagementAgentContact].Form.RecordSource =
"qryManagementAgentContact"
'-------------------------------------------------------------------
' management agent
'
sqlString = "SELECT DISTINCT active_property.property_id,
active_property_participant.mgmt_agent_org_name,
active_property_participant.mgmt_agent_address_line1,
active_property_participant.mgmt_agent_address_line2,
active_property_participant.mgmt_agent_city_name,
active_property_participant.mgmt_agent_state_code,
active_property_participant.mgmt_agent_zip_code,
active_property_participant.mgmt_agent_main_phone_number,
active_property_participant.mgmt_agent_main_fax_number,
active_property_participant.mgmt_agent_email_text " & _
"FROM active_property INNER JOIN active_property_participant ON
active_property.property_id = active_property_participant.property_id " & _
"WHERE (((active_property.property_id)=" & PID & "))"
'------------------------------------------------------------
' management agent
' create the Query for the report
'
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryManagement" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryManagement", sqlString)
'DoCmd.OpenQuery qdf.Name
Forms![frmPIR_3].[frmManagement].Form.RecordSource = "qryManagement"
'------------------------------------------------------------
' property manager
'
sqlString = "SELECT DISTINCT active_property.property_id,
active_property_participant.mgmt_contact_full_name,
active_property_participant.mgmt_contact_address_line1,
active_property_participant.mgmt_contact_address_line2,
active_property_participant.mgmt_contact_city_name,
active_property_participant.mgmt_contact_state_code,
active_property_participant.mgmt_contact_zip_code,
active_property_participant.mgmt_contact_main_phn_nbr,
active_property_participant.mgmt_contact_main_fax_nbr,
active_property_participant.mgmt_contact_email_text " & _
"FROM active_property INNER JOIN active_property_participant ON
active_property.property_id = active_property_participant.property_id " & _
"WHERE (((active_property.property_id)=" & PID & "))"
'---------------------------------------
' create the Query for the report
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryPropertyManager" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryPropertyManager", sqlString)
Forms!frmPIR_3.[frmPropertyManager].Form.RecordSource =
"qryPropertyManager"
'-----------------------------------------------------
' owner section
'
sqlString = "SELECT DISTINCT active_property_participant.property_id,
active_property_participant.owner_organization_name,
active_property_participant.owner_address_line1,
active_property_participant.owner_address_line2,
active_property_participant.owner_city_name,
active_property_participant.owner_state_code,
active_property_participant.owner_zip_code,
active_property_participant.owner_main_phone_number_text,
active_property_participant.owner_main_fax_number_text,
active_property_participant.owner_email_text,
active_property_participant.owner_contact_indv_full_name,
active_property_participant.owner_contact_main_phone_num,
active_property_participant.owner_contact_main_fax_num,
active_property_participant.owner_contact_email_text " & _
"FROM active_property_participant " & _
"WHERE active_property_participant.property_id=" & PID
'---------------------------------------
' create the Query for the report
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryOwner" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryOwner", sqlString)
Forms![frmPIR_3]![frmOwner].Form.RecordSource = "qryOwner"
'-----------------------------------------------------
' mortgagee section
'
sqlString = "SELECT DISTINCT
active_property.property_id,financing_instrument.primary_loan_code,
hometab.institution_name, hometab.m_addr_line1, hometab.m_addr_line2,
hometab.m_city, hometab.m_state, hometab.m_zip1 " & _
"FROM (active_property INNER JOIN financing_instrument ON
active_property.property_id = financing_instrument.property_id) INNER JOIN
hometab ON financing_instrument.srvcr_mrtge_nbr = hometab.srvcr_mrtge_nbr " &
_
"WHERE (((active_property.property_id)= " & PID & ") AND
((financing_instrument.primary_loan_code)='1'))"
'---------------------------------------
' create the Query for the report
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryMortgagee" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryMortgagee", sqlString)
Forms![frmPIR_3]![frmMortgagee].Form.RecordSource = "qryMortgagee"
'-----------------------------------------------------
' Contract Administrator Contact
'
'---------------------------------------
' create the Query for the report
sqlString = "SELECT DISTINCT contract_contact.property_id,
contract_contact.contact_name, contract_contact.main_phone,
contract_contact.main_fax, contract_contact.email,
contract_contact.street_address, contract_contact.street2_address,
contract_contact.city, contract_contact.state, contract_contact.zip_code,
contract_contact.zip4_code " & _
"FROM contract_contact INNER JOIN contract_participant ON
contract_contact.contract_number=contract_participant.contract_number " & _
"WHERE (((contract_contact.property_id)=" & PID & "))"
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryContractAdminContact" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryContractAdminContact", sqlString)
Forms![frmPIR_3]![frmContractAdminContact].Form.RecordSource =
"qryContractAdminContact"
'-----------------------------------------------------
' Contract Administrator
'
'---------------------------------------
' create the Query for the report
sqlString = "SELECT DISTINCT active_property.property_id,
address.street_address, address.street2_address, address.city, address.state,
address.zip_code, address.zip4_code, address.county_name,
participant.indv_last_name, participant.indv_first_name,
participant.org_name, participant.main_phone, participant.main_fax,
participant.email " & _
"FROM ((active_property INNER JOIN contact_participant ON
active_property.property_id = contact_participant.property_id) INNER JOIN
participant ON contact_participant.participant_id =
participant.participant_id) INNER JOIN (participant_address INNER JOIN
address ON participant_address.address_id = address.address_id) ON
participant.participant_id = participant_address.participant_id " & _
"WHERE active_property.property_id = " & PID
dbs.querydefs.Refresh
' If query exists, delete it.
For Each qdf In dbs.querydefs
If qdf.Name = "qryContractAdmin" Then
dbs.querydefs.Delete qdf.Name
End If
Next qdf
Set qdf = dbs.CreateQueryDef("qryContractAdmin", sqlString)
Forms![frmPIR_3]![frmContractAdmin].Form.RecordSource = "qryContractAdmin"
'------------------------------------------------------------------------
' Financing_instrument section
'
'sqlString = "SELECT DISTINCT financing_instrument.property_id,
financing_instrument.primary_loan_code, financing_instrument.fha_number,
dbo_soa_reference.soa_nmrc_name, financing_instrument.final_endorsement_date,
financing_instrument.excess_inc_ind, financing_instrument.excess_inc_end_date
" & _
' "FROM financing_instrument INNER JOIN dbo_soa_reference ON
financing_instrument.section_code = dbo_soa_reference.section_code " & _
' "WHERE (((financing_instrument.property_id)=" & PID & "))"
'---------------------------------------
' create the Query for the report
'dbs.querydefs.Refresh
' If query exists, delete it.
'For Each qdf In dbs.querydefs
' If qdf.Name = "qryFinancingInstrument" Then
' dbs.querydefs.Delete qdf.Name
' End If
'Next qdf
'Set qdf = dbs.CreateQueryDef("qryFinancingInstrument", sqlString)
'Forms![frmPIR_3]![frmContractAdmin].Form.RecordSource =
"qryFinancingInstrument"
Exit Sub
error_handler:
'error occured error_handler
MsgBox "An Error Occured (frmPIR): " & Err.Description & _
(Chr(13)) & "error #: " & Err.Number & _
(Chr(13)) & "error source: " & Err.Source
Exit Sub
End Sub