Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / August 2005

Tip: Looking for answers? Try searching our database.

error loading DLL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
phillip9 - 09 Aug 2005 20:56 GMT
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
Douglas J. Steele - 09 Aug 2005 22:14 GMT
What you can try and do is ensure that the same referenced files exist on
all workstations.

Grab the code from http://www.mvps.org/access/api/api0065.htm at "The Access
web" and save it in a module.

On the workstation where the application was developed, open up the MDB that
was used to create the MDE. Run the following code to determine all of the
required references and the version that's being expected:

Sub ListReferences()
Dim refCurr As Reference

 For Each refCurr In Application.References
   Debug.Print refCurr.Name & ": " & refCurr.FullPath & _
     " (" & fGetProductVersion(refCurr.FullPath) & ")"
   Next

End Sub

Next, on the workstation(s) where the application isn't working, check to
see that the exact same version of each of those files is located in exactly
the same location.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Hello everyone,
>
[quoted text clipped - 343 lines]
>
> End Sub
phillip9 - 10 Aug 2005 15:59 GMT
Hello Mr. Steele,

I have tried copying the code you linked to into my Module1.  When I
compile, I get the following error:
  compile error:   only comments may appear after End Sub, End Function, or
End Property

With the error occuring on the "Private Declare Function
apiGetFileVersionInfoSize line
(see code sample below)  I did notice that the IDE is not putting a
function/sub line-break before that line in the IDE window.  So, I wonder if
this code sample is missing either an "END SUB" or "end function" line?

----- code with error listed below -------

' ******** Code Start ********
'This code was originally written by Dev Ashish.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code Courtesy of
'Dev Ashish
'
'  structure contains version information about a file. This
'  information is language and code page independent.
Private Type VS_FIXEDFILEINFO
   '  Contains the value 0xFEEFO4BD (szKey)
   dwSignature As Long
   '  Specifies the binary version number of this structure.
   dwStrucVersion As Long
   '  most significant 32 bits of the file's binary version number.
   dwFileVersionMS As Long
   '  least significant 32 bits of the file's binary version number.
   dwFileVersionLS As Long
   '  most significant 32 bits of the binary version number of
   ' the product with which this file was distributed
   dwProductVersionLS As Long
   '  least significant 32 bits of the binary version number of
   ' the product with which this file was distributed
   dwFileFlagsMask As Long
   '  Contains a bitmask that specifies the valid bits in dwFileFlags.
   dwProductVersionMS As Long
   '  Contains a bitmask that specifies the
   '  Boolean attributes of the file.
   dwFileFlags As Long
   '  operating system for which this file was designed.
   dwFileOS As Long
   '  general type of file.
   dwFileType As Long
   '  function of the file.
   dwFileSubtype As Long
   '  most significant 32 bits of the file's 64-bit
   ' binary creation date and time stamp.
   dwFileDateMS As Long
   '  least significant 32 bits of the file's 64-bit binary
   ' creation date and time stamp.
   dwFileDateLS As Long
End Type

' ------ ****   error happens at the following function **** ----------
'  Returns size of version info in Bytes
Private Declare Function apiGetFileVersionInfoSize _
   Lib "version.dll" Alias "GetFileVersionInfoSizeA" _
   (ByVal lptstrFilename As String, _
   lpdwHandle As Long) _
   As Long

'  Read version info into buffer

> What you can try and do is ensure that the same referenced files exist on
> all workstations.
[quoted text clipped - 286 lines]
> > contract_contact.contract_number=contract_participant.contract_number " &
> > _
Douglas J. Steele - 10 Aug 2005 22:47 GMT
I just copied the code from "The Access Web" into a module and it ran
without any errors.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Hello Mr. Steele,
>
[quoted text clipped - 382 lines]
>> > &
>> > _
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.