Runtime Error 429 - ActiveX Component Can't Create Object (1 Viewer)

mac.vba

Registered User.
Local time
Today, 00:25
Joined
Mar 12, 2012
Messages
18
Hello Folks,

I'm using the below code in msaccess which used to work perfectly on the Win XP platform. I upgraded my OS to Win 7. It's now giving an error as "Runtime Error 429 - ActiveX Component Can't Create Object". I unchecked & rechecked all the library references.

Function GetNetWorkDays(startDate As Date, endDate As Date) As Integer
Dim objFunction As MSOWCFLib.OCATP
Set objFunction = New MSOWCFLib.OCATP
GetNetWorkDays = objFunction.NETWORKDAYS(startDate, endDate)
Set objFunction = Nothing
End Function

Old OS: Win XP
New: Win 7
Old msaccess: 2003
New: 2010
Old office: 2003
New: 2010

Please help.
 

mac.vba

Registered User.
Local time
Today, 00:25
Joined
Mar 12, 2012
Messages
18
There's no MISSING reference in the library. I unchecked & rechecked all the references. On XP, it's working. Issue is with Win 7.

Old OS: Win XP
New: Win 7
Old msaccess: 2003
New: 2010
Old office: 2003
New: 2010
 

michaeljryan78

Registered User.
Local time
Today, 03:25
Joined
Feb 2, 2011
Messages
165
There may be another way to accomplish this without having to use that reference. It requires a holoday table (tblHolidays) with Holdate as a datetime field.

Code:
Function GetWorkDays(dtDateIn As Date, dtDateOut As Date) As Integer
Dim x As Integer
Dim rs As Recordset
Dim db As Database
Dim strSQL As String
Dim dtIncrement As Date
strSQL = "Select holDate from tblHolidays"
x = 0
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
dtIncrement = dtDateIn
Do Until dtIncrement = dtDateOut
 
    Select Case Weekday(dtIncrement)
        Case vbMonday To vbFriday
            rs.FindFirst ("holDate = #" & Format(dtIncrement, "mm/dd/yyyy") & "#")
            If rs.NoMatch = True Then
                x = x + 1
            End If
    End Select
    dtIncrement = dtIncrement + 1
Loop
GetWorkDays = x
rs.Close
Set rs = Nothing
Set db = Nothing
End Function
 

mac.vba

Registered User.
Local time
Today, 00:25
Joined
Mar 12, 2012
Messages
18
No, there's no holiday table required in the calculation. please help without considering Holidays.

In XP, I had the below code working:

Function GetNetWorkDays(startDate As Date, endDate As Date) As Integer
Dim objFunction As MSOWCFLib.OCATP
Set objFunction = New MSOWCFLib.OCATP
GetNetWorkDays = objFunction.NetWorkDays(startDate, endDate)
Set objFunction = Nothing
End Function

In Win 7, MSOWCF.dll file is not working even after updating library. Error: Runtime Error 429 - ActiveX Component Can't Create Object. "MSOWCFLib.OCATP" is MSOWCF.dll library which calculates networkdays in msaccess.

Either help me in rectifying this issue or modify your code.
Note: No Holiday table is required.
 

michaeljryan78

Registered User.
Local time
Today, 03:25
Joined
Feb 2, 2011
Messages
165
Code:
Function GetWorkDays(dtDateIn As Date, dtDateOut As Date) As Integer
Dim x As Integer
Dim dtIncrement As Date
x = 0
dtIncrement = dtDateIn
Do Until dtIncrement = dtDateOut
 
    Select Case Weekday(dtIncrement)
        Case vbMonday To vbFriday
                x = x + 1
    End Select
    dtIncrement = dtIncrement + 1
Loop
GetWorkDays = x
End Function
 

mac.vba

Registered User.
Local time
Today, 00:25
Joined
Mar 12, 2012
Messages
18
Michael, excellent job. It's working fine. Thank you
 

Users who are viewing this thread

Top Bottom