X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Script Not Working, Access 2019    
post Oct 18 2019, 04:27 PM

Posts: 17
Joined: 21-September 16

Hi, I was using the following script in my database for quite some time before not using the database for a while. Now i am in need of using the database again, it keeps flashing up an error when running the code.

sSQL = "Select * from Table3" 'This has to be the name of the query your report is using to display data
With oExcel
.Visible = True

With WB
Set WS = WB.Worksheets("Sheet1") 'Replace with the name of actual sheet
With WS
objrs.Open sSQL, objConn, adOpenSta
Set rng = .Range("AQ3") 'Starting point of the data range
rng.CopyFromRecordset objrs
End With
End With

End With

I get the following message

Run-time error '-22147221164 (80040154)'

when select Debug, it highlights with WB in yellow.

I am at a loss as to what the problem is. Can someone please help she some light on this?
This post has been edited by Fenderrick: Oct 18 2019, 04:33 PM
Attached File(s)
Attached File  error_message.jpg ( 65.96K )Number of downloads: 6
Attached File  debug.jpg ( 105.72K )Number of downloads: 5
Go to the top of the page
Start new topic
post Oct 18 2019, 06:24 PM

UA Admin
Posts: 36,574
Joined: 20-June 02
From: Newcastle, WA

The error message description says "Class not registered" That's not a commonly seen error, I think.

However, I suspect it may have something to do with the reference to Excel. Do you have that done appropriately for your current Office version (2019)?

Attached File  ExcelReference.png ( 21.73K )Number of downloads: 2

I have Office 2016 installed, so my Office References will be different from yours.

Also, to be clear, you posted this question in the ASP and VBScript forum, which has to do with web pages, not Access Relational Database Applications. You refer to this as a "script", but in the Access world, we'd call it a Function, rather than a script. So, can you confirm this is, in fact, a VBA module in an Access Relational Database Application?
This post has been edited by GroverParkGeorge: Oct 18 2019, 06:29 PM

My Real Name Is George. Grover Park Consulting is where I did business for 20 years.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
post Oct 18 2019, 06:32 PM

Posts: 17
Joined: 21-September 16

Hi, yes it is a VBA script, sorry thought I was in the right area lol. I originally created the database in access 2007, and now run 2019. I have only just updated to 2019 and the problem had already started with 2007.

Thanks for your help everyone.

Go to the top of the page

Posts in this topic

Custom Search

RSSSearch   Top   Lo-Fi    28th January 2020 - 07:49 AM