Discussion:
VBA - Access 97 to 2003
(too old to reply)
Bill B
2008-02-05 14:32:56 UTC
Permalink
Hi All.

I'm having a heck of a time here trying to sort some code out in an attempt
to convert a few VBA modules from 97 to 2003 and compile them.

At the moment I'm getting this error:

Error: Object variable or With block variable not set

from this code:

Function ref_intStartNewAccess() As Integer
On Error GoTo ref_intStartNewAccess_Err

Dim intRet As Integer
Dim mappAccess As Object

ref_SetStatus 0, "Starting Access 2003 ..."
'Stop

Set mappAccess = CreateObject("Access.Application.11")
'mappAccess.Visible = false

intRet = True

'Stop
ref_intStartNewAccess_Exit:
ref_intStartNewAccess = intRet
Exit Function

ref_intStartNewAccess_Err:
intRet = False
MsgBox "Error: " & Error$, vbExclamation, "ref_intStartNewAccess()"
Resume ref_intStartNewAccess_Exit

End Function

Private Sub ref_SetStatus(ByVal pintType As Integer, ByVal pvarText As
Variant)

Dim strMsg As String
Dim frm As New Form
Set frm = Forms!frmStatus

If Not IsNull(pvarText) Then strMsg = pvarText

Select Case pintType
Case 0
frm!lblMsg.Caption = strMsg
Case 1
frm!lblAppDB.Caption = strMsg
Case 2
frm!lblAppDesc.Caption = strMsg
Case 3
frm!lblLibDB.Caption = strMsg
Case 4
frm!lblPath.Caption = strMsg
End Select

frm.Repaint


End Sub

Any help sorting this out would be greatly appreciated.

Bill
Pat Hartman
2008-02-11 14:56:32 UTC
Permalink
Nothing jumps out at me. Have you checked the references? The errors
caused by missing references manifest themselves in numerous ways.

PS - I wouldn't refer specifically to Access 11. I would just use
Access.Application since that will give you more flexibility. Of course, if
you have earlier versions of Access installed and your code will only run
with A2003, then you have no choice.
Post by Bill B
Hi All.
I'm having a heck of a time here trying to sort some code out in an
attempt to convert a few VBA modules from 97 to 2003 and compile them.
Error: Object variable or With block variable not set
Function ref_intStartNewAccess() As Integer
On Error GoTo ref_intStartNewAccess_Err
Dim intRet As Integer
Dim mappAccess As Object
ref_SetStatus 0, "Starting Access 2003 ..."
'Stop
Set mappAccess = CreateObject("Access.Application.11")
'mappAccess.Visible = false
intRet = True
'Stop
ref_intStartNewAccess = intRet
Exit Function
intRet = False
MsgBox "Error: " & Error$, vbExclamation, "ref_intStartNewAccess()"
Resume ref_intStartNewAccess_Exit
End Function
Private Sub ref_SetStatus(ByVal pintType As Integer, ByVal pvarText As
Variant)
Dim strMsg As String
Dim frm As New Form
Set frm = Forms!frmStatus
If Not IsNull(pvarText) Then strMsg = pvarText
Select Case pintType
Case 0
frm!lblMsg.Caption = strMsg
Case 1
frm!lblAppDB.Caption = strMsg
Case 2
frm!lblAppDesc.Caption = strMsg
Case 3
frm!lblLibDB.Caption = strMsg
Case 4
frm!lblPath.Caption = strMsg
End Select
frm.Repaint
End Sub
Any help sorting this out would be greatly appreciated.
Bill
Continue reading on narkive:
Loading...