OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 21-11-2004, 17:48
graphicdesigner
Guest
 
Posts: n/a
Default object variable not found

i am trying to call a form from another form
here is a piece of code of what i am doing

there is a form called changetext. in the code i am trying to call another form

Code:
Private Function ImportExcelFile(ByVal DBFILE As String) As Collection
    Dim col As New Collection
    Dim rec As clsDataRecord
    
    Dim cnn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim s As String
    Dim i As Integer
    'Dim oform As Object
    'Set oform = New TableSelectForm
    
    ' Open the connection to an Excel file
     cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
             "Data Source=" & DBFILE & ";" & _
             "Extended Properties=""Excel 8.0; HDR=No; IMEX=2;"""
    
    Set rsTables = cnn.OpenSchema(adSchemaTables)
       'here is where i call the tableselcetform 
TableSelectForm.Show vbModeless
it goes to the useer form intialise method whose code i have it as

Public Sub UserForm_Initialize()
TableSelected = ""

cbTables.Clear
'after thsi statement i get the error
While Not rsTables.EOF
If rsTables![TABLE_TYPE] = "TABLE" Then
' Enumerate tables only; omit views, etc.
cbTables.AddItem rsTables![TABLE_NAME]
End If
rsTables.MoveNext
Wend

If cbTables.ListCount > 0 Then
' Select the first item
cbTables.ListIndex = 0
End If
End Sub

as soon as it goes into rstables.EOF it does not find anything in it and it give an error saying
Run time error 91
object variable or with block variable not set
i have set rstables as public or ado recordset type in form change text

i dont know what is wrong
any idea some one.

thanks
Attached Images
 
Reply With Quote
  #2  
Old 22-11-2004, 13:11
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: object variable not found

Where and how rsTables variable is defined?

Make sure it is at a global module level and defined as Public...
Reply With Quote
  #3  
Old 22-11-2004, 13:41
graphicdesigner
Guest
 
Posts: n/a
Default

retables is in the global module table and PUBLIC...


here is it where i have declared.
Option Explicit

Public nUserUnit As Integer
Public dRefX, dRefY, dRefX1, dRefY1 As Double
Public dLeftRightMargin, dTopBottomMargin As Double
Public dXCoord, dYCoord As Double
Public dFontSize As Double
'Dim dFontface As FontList
Dim sFileName As String
Public c As Color
'Dim dhalignment As cdrAlignment
'Dim dvalignment As cdrVerticalAlignment
Dim iFile As Integer, FileName As String
Dim DBFILE As String
Dim oform As TableSelectForm
Public strLog As String
Public CurRecord As Long
'Public sArray() As String
Dim txtalignment As cdrAlignment
Public Records As Collection
'declaring an instance for tableform

' rstables variable delcared and public....
Public rsTables As ADODB.Recordset
Public TableSelected As String


'Collection Variables
Dim collPages As Pages
Dim collShapes As Shapes
Dim sLabel As Shape

what am i doing wrong.
Reply With Quote
  #4  
Old 22-11-2004, 19:12
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Well, everything looks correct. Are you sure that you are calling ImportExcelFile function and not, say, ImportAccessFile which also calls that form but fails to set rsTables variable?
Reply With Quote
  #5  
Old 22-11-2004, 19:13
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Also put "Option Explicit" in every code module and form code just to make sure you are not making a typo error somewhere...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CDR12: refresh Object Manager docker after CreateSelection zlatev CorelDRAW/Corel DESIGNER VBA 2 05-03-2005 10:00
Bounding lines around an object toy4mud CorelDRAW CS 2 04-11-2004 12:56
Sorting entries in the object manager dan CorelDRAW/Corel DESIGNER VBA 1 18-08-2004 23:16
Would you miss CorelScript object? Alex CorelDRAW/Corel DESIGNER VBA 32 04-02-2004 15:59
Stroke Object Script NOT found in MegaGallery9 vallentin Macros/Add-ons 0 23-11-2003 21:27


All times are GMT -5. The time now is 12:41.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com