A
A
Alexander Shilov2019-04-24 15:50:41
Visual Basic
Alexander Shilov, 2019-04-24 15:50:41

Customize ActiveX in Excel?

Kind time of the day, habrets, tell me, please. There is a connection from Excel to Access.
On the computer on which the VBA code was written, everything works, on others it gives an error

mistake
5cc05b47ac4e7575491096.png5cc05b96acaa2910849202.png
the code
Sub Получить_данные_о_программе()
    Dim tbl As Recordset
    Dim SQLr As String
    Dim dbs As Database
    Dim lists_count As Long
    
    ActiveSheet.Protect Password:="123698745", UserInterfaceOnly:=True
    
    Sheets("Главная панель").Rows("17:100000").Delete shift:=xlUp
    
    lists_count = Int(Sheets("Главная панель").Range("A1").Text)
    
    Set dbs = DAO.OpenDatabase("\\srv02\_tp\Shilov\BD\db.mdb")
    
    SQLr = "SELECT f_name FROM win32_applications WHERE computer_name = '" & Sheets("Данные").Cells(lists_count + 1, 8).Text & "'"
    
    Set tbl = dbs.OpenRecordset(SQLr)
    
    Sheets("Главная панель").Cells(17, 1).CopyFromRecordset tbl
    tbl.Close
    
    Set tbl = Nothing
    
    dbs.Close
    
    Set dbs = Nothing
End Sub

Answer the question

In order to leave comments, you need to log in

3 answer(s)
B
BasiC2k, 2019-04-24
@BasiC2k

I will assume that on other PCs there is a 64-bit version of MS Office, and on your x86. There are no DAO libraries for x64.

I
idShura, 2019-04-24
@idShura

Is the "Microsoft office xx database engine object library " library connected?

A
Alexander, 2019-04-24
@NeiroNx

I think the file \\srv02\_tp\Shilov\BD\db.mdb is not available from other computers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question