Ian Bayly
2007-11-11 23:53:21 UTC
I have a VB6 dll which is referenced in Word 2003.
I also have the dll running as part of a VB Group so I can test from the VB
IDE.
The dll works fine on my development PC so I packaged it and ran a test
install on another PC.(Both XPPro but different SP levels)
Very frustrating - my start-up function will not run from Word, but WILL run
from my VB IDE on the new PC.
The start-up function calls a login form, requests a Name/Password, encrypts
them and then checks in an MDB whether the logon is valid.
The code fails when creating a recordset using ADO with message "Error
number: 91 Object variable or with block variable not set."
By inserting msgboxes all paths etc are initialising correctly.
Again I emphasise - It runs fine from VB IDE and runs fine from Word on the
development PC, but fails when called from Word on the test PC.
I'm getting fairly desperate!!! Any help appreciated.
TIA
Ian B
Code snips below
from Login Form where error occurs at line 90
40 sCryptName = EncryptText(sRawName, txtPassword)
50 sCryptPwd = EncryptText(sRawPwd, txtPassword)
60 Debug.Print sCryptName
70 Debug.Print sCryptPwd
80 sSQL = "Select * from tblUser WHERE tblUser.UserName= '" & sCryptName
& "'"
90 Call GetRecordset(sSQL)
FAILS HERE
Snip from Public Function GetRecordSet (myRS is a global variable)
Dim myConn As New ADODB.Connection
10 On Error GoTo GetRecordset_Error
20 GetRecordset = False
30 myConn.CursorLocation = adUseClient
40 myConn.Open sConnString & "Data Source = " & sDBPath & ";"
PATH IS CORRECT
50 Set myRs = New ADODB.Recordset
60 myRs.CursorType = adOpenKeyset
70 myRs.LockType = adLockOptimistic
80 myRs.ActiveConnection = myConn
90 myRs.Open (sSQL)
100 Debug.Print sSQL
110 GetRecordset = True
120 On Error GoTo 0
130 Exit Function
Snip from calling Word Macro
10 On Error GoTo xxxLogin_Err
Dim clMain_o As New clMain
20 Call clMain_o.StartAction("Login")
I also have the dll running as part of a VB Group so I can test from the VB
IDE.
The dll works fine on my development PC so I packaged it and ran a test
install on another PC.(Both XPPro but different SP levels)
Very frustrating - my start-up function will not run from Word, but WILL run
from my VB IDE on the new PC.
The start-up function calls a login form, requests a Name/Password, encrypts
them and then checks in an MDB whether the logon is valid.
The code fails when creating a recordset using ADO with message "Error
number: 91 Object variable or with block variable not set."
By inserting msgboxes all paths etc are initialising correctly.
Again I emphasise - It runs fine from VB IDE and runs fine from Word on the
development PC, but fails when called from Word on the test PC.
I'm getting fairly desperate!!! Any help appreciated.
TIA
Ian B
Code snips below
from Login Form where error occurs at line 90
40 sCryptName = EncryptText(sRawName, txtPassword)
50 sCryptPwd = EncryptText(sRawPwd, txtPassword)
60 Debug.Print sCryptName
70 Debug.Print sCryptPwd
80 sSQL = "Select * from tblUser WHERE tblUser.UserName= '" & sCryptName
& "'"
90 Call GetRecordset(sSQL)
FAILS HERE
Snip from Public Function GetRecordSet (myRS is a global variable)
Dim myConn As New ADODB.Connection
10 On Error GoTo GetRecordset_Error
20 GetRecordset = False
30 myConn.CursorLocation = adUseClient
40 myConn.Open sConnString & "Data Source = " & sDBPath & ";"
PATH IS CORRECT
50 Set myRs = New ADODB.Recordset
60 myRs.CursorType = adOpenKeyset
70 myRs.LockType = adLockOptimistic
80 myRs.ActiveConnection = myConn
90 myRs.Open (sSQL)
100 Debug.Print sSQL
110 GetRecordset = True
120 On Error GoTo 0
130 Exit Function
Snip from calling Word Macro
10 On Error GoTo xxxLogin_Err
Dim clMain_o As New clMain
20 Call clMain_o.StartAction("Login")