I have the below code that has been working for a couple months in MS Access 2007, 32 Bit, Win 7.
I just upgraded to MS Access 2019, 64 Bit, Win 10.
This line is causing an error: Class Not Registered
SessMgr.OpenConnection "", "Highest InvNo"
I have the same references I used in Access 2007. I'm guessing qbFC13,dll is the issue. I've re-registered it. I've reinstalled the SDK software. I've installed MS Access 2007 on the Win 10 computer and it works as expected. But not in Access 2019.
Has anyone had any issues upgrading from 2007 to 2019?
Any thoughts on where I should be looking, or trying to troubleshoot this?
Code:
Public Function InvNo()
DoCmd.Hourglass True
DoCmd.Echo True, "Pulling Invoice Numbers from QBES, please wait...."
'This code pulls a range of highest Invoice numbers from QBES and populates table: TempBatchInvNo.
'Then Query: qry_TempBatchInvNo_Max sets up next highest InvNo.
Dim accessDB As Database
Set accessDB = CurrentDb
If (accessDB Is Nothing) Then
Exit Function
End If
Dim SessMgr As New QBSessionManager
SessMgr.OpenConnection "", "Highest InvNo"
SessMgr.BeginSession "", omDontCare
Dim msgReq As IMsgSetRequest
Set msgReq = SessMgr.CreateMsgSetRequest("US", 13, 0)
Dim query As IInvoiceQuery
Set query = msgReq.AppendInvoiceQueryRq
'Establish a begin date to pull InvNo from QBES: 4 days before current date.
'QBES required date format "yyyy-mm-dd".
Dim FromDate
FromDate = CStr(FromDate)
FromDate = Format(Date - 4, "yyyy-mm-dd")
'Establish end date (today) for most current InvNo from QBES.
'QBES required date format "yyyy-mm-dd".
Dim ToDate
ToDate = CStr(ToDate)
ToDate = Format(Date, "yyyy-mm-dd")
'Filter InvNo numbers by Transaction Dates "To" and "From". See above variables.
query.ORInvoiceQuery.InvoiceFilter.ORDateRangeFilter.TxnDateRangeFilter.ORTxnDateRangeFilter.TxnDateFilter.FromTxnDate.SetValue (FromDate)
query.ORInvoiceQuery.InvoiceFilter.ORDateRangeFilter.TxnDateRangeFilter.ORTxnDateRangeFilter.TxnDateFilter.ToTxnDate.SetValue (ToDate)
'Set maximum number of records returned DO NOT USE THIS FILTER
'query.ORInvoiceQuery.InvoiceFilter.MaxReturned.SetValue (10)
'DoEvents makes sure invoices are pulled from QBES before moving forward
DoEvents
Dim resp As IMsgSetResponse
Set resp = SessMgr.DoRequests(msgReq)
Dim respList As IResponseList
Set respList = resp.ResponseList
Dim curResp As IResponse
Set curResp = respList.GetAt(0)
'Delete all records from Table: TempBatchInvNo
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE * FROM TempBatchInvNo"
DoCmd.SetWarnings True
If (curResp.statusCode = 0) Then
Dim respType As IResponseType
Set respType = curResp.Type
If (respType.GetValue = rtInvoiceQueryRs) Then
Dim InvNoList As IInvoiceRetList
Set InvNoList = curResp.Detail
Dim curInvoices As IInvoiceRet
Dim i As Integer
Dim insSQL As String
For i = 0 To InvNoList.Count - 1
insSQL = "INSERT INTO TempBatchInvNo " _
& "(InvNo) " _
& "VALUES " _
& "("
Set curInvoices = InvNoList.GetAt(i)
insSQL = insSQL & "'" & curInvoices.RefNumber.GetValue & "')"
accessDB.Execute insSQL
Next i
End If
End If
'Print SQL to Intermediate Window below
'Example: INSERT INTO TempBatchInvNo (InvNo) VALUES ('644923')
'Debug.Print insSQL
SessMgr.EndSession
SessMgr.CloseConnection
Set SessMgr = Nothing
'Close recordset
accessDB.Close
Set accessDB = Nothing
Set accessDB = Nothing
End Function
Thanks!