|
-
Oct 23rd, 2002, 01:29 AM
#1
Thread Starter
Junior Member
Object variable not set
Hi Guys
have a problem with an object not getting created when my dll is called. I have registered all the dll's manually and set up a debug environment to step through my code. What happens is when my dll is called I have a call to a sub routine to create some tables, in this sub I have declared an object of type DBquery (dim DBquery as new pdDatabasequery) i then set myVar which is a object of type PDRecordAdapter (dim myVar as PDRecordAdapter) next I "set myVar = DBquery.Createrecorddatabase(params)"....on this line I get the Object error (91).
Option Explicit
Implements IPDClientNotify
Public Function IPDClientNotify_BeginProcess() As Boolean
Create_Tables
Main_Sub
IPDClientNotify_BeginProcess = False
End Function
Private Sub IPDClientNotify_CfgConduit(ByVal nCreatorId As Long, ByVal nUserId As Long, ByVal bstrUserName As String, ByVal bstrPathName As String, nSyncPerm As Long, nSyncTemp As Long, nSyncNew As Long, nSyncPref As Long)
Debug.Print "IPDClientNotify_CfgConduit"
End Sub
Private Sub IPDClientNotify_ConfigureConduit(ByVal pPathName As String, ByVal pRegistry As String, nSyncPref As Long, nSyncType As Long)
Debug.Print "IPDClientNotify_ConfigureConduit"
End Sub
Private Function IPDClientNotify_GetConduitInfo(ByVal infoType As PDDirectLib.EGetConduitInfo, ByVal dwCreatorId As Long, ByVal dwUserId As Long, ByVal bstrUserName As String) As Variant
Debug.Print "IPDClientNotify_GetConduitInfo"
End Function
Private Sub Create_Tables()
Dim hhrec As PDRecordAdapter
Dim pDbQuery As New PDDatabaseQuery
'----the object is not created here for some reason----
On Error Resume Next
pDbQuery.AddLogEntry "Starting to create tables", eText, False, False
If (Err.Number = 0) Then
Err.Clear
Set hhrec = pDbQuery.CreateRecordDatabase("HH_orgdrugmatrix", "PDDirect.PDRecordAdapter", "PAIC", "DATA", eRead Or eWrite Or eShowSecret, eRecord, 1, 0)
error occurs here ^
Anyone ??
Thanks
Last edited by Essex; Oct 23rd, 2002 at 01:33 AM.
-
Oct 23rd, 2002, 04:43 AM
#2
What are the pdDatabasequery & PDRecordAdapter from, is this a standard reference object library?
dim DBquery as new pdDatabasequery
Try to use your objects this way in future as this is more efficient: 
Dim DBquery as pdDatabasequery
Set DBquery as New pdDatabasequery
-
Oct 23rd, 2002, 05:46 AM
#3
Thread Starter
Junior Member
Thanks Alex,
I thought that it was more efficient to declare your objects this way
dim obj as new Obj
as opposed to
dim obj as Obj
set obj = new obj
Doh got it wrong again
Anyway...the objects you are referring to are Palm conduit objects. I'm trying to write my first COM conduit and compiling it as an EXE it runs ok but when converting it to a DLL causes the error above. There is something that is not right with the way things are setup on my PC. When I try to run one of the examples that come with the CDK I get the same error and I don't have a lot of experience with COM programming to know where to look.
Essex
-
Oct 23rd, 2002, 06:04 AM
#4
Right then I'm lost as I've never programmed anything to do with palms 
VB Code:
"set myVar = DBquery.Createrecorddatabase(params)"....on this line I get the Object error (91).
At the moment I can tell you what I'm thinking, it could be that the DBQuery object isn't properly setup, and the program fails on trying to call the Createrecorddatabase method on a non-existant object.
To check this one is easy, type in the first bit (as below) and hit the dot, if the Createrecorddatabase method is listed there, this would mean your object was setup correctly using the right data type and this method can be used.
set myVar = DBquery.
The other thing I'm thinking of is whether the variable declaration for the myVar object is correct and you're not doing the equivalent of this:
Dim avalue as integer
avalue="Strringvalue"
To check that the PDRecordAdapter data type is correct, try declaring the myVar variable as an object or variant and running your program to see if this makees a difference...
-
Oct 23rd, 2002, 06:23 AM
#5
Thread Starter
Junior Member
The DBquery object is setup properly because the dot operator displays all the members of the object are available but one thing I have noticed is that the
Implements IPDClientNotify
is equal to nothing after the prog has started. Is this normal?
-
Oct 23rd, 2002, 07:15 AM
#6
Thread Starter
Junior Member
Something else I've discovered....I'M ON MY OWN... just kidding...when I compile and run the program as an EXE it runs ok, the objects are created and run as per normal...but the minute I change it to a DLL the objects don't get created. can anyone with DLL experience help here??
-
Oct 25th, 2002, 04:34 AM
#7
Hiya Essex (whatever your real name is) 
I noticed no-one else has posted yet, any chance of uploading your code - though I've dealt with palm coding (I normally use my fingers instead ) I'll see if I might be able to help.
To get this running though I need you also to upload any palm dll's you use also. Thanks.
-
Oct 25th, 2002, 11:20 PM
#8
Thread Starter
Junior Member
Thanks Alex, send me your email address as the file is too large to send via VB-World... [email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|