Solved

How to set an object, that passed from a module

Posted on 2004-04-25
5
142 Views
Last Modified: 2010-05-19
Hi there!

I have this module imgLibrary. This imgLibrary will call another module that reside in another project (Project B)
The name of the module in Project B is RSDOCMOD02.bas.

The problem is, i can't call this RSDOCMOD02 module. It give an error msg "Object variable or With block variable not set

Below is the code of imgLibrary

Option Explicit

Public Function ReadFromDB(ByVal TblName As String, _
  Optional ByVal SearchStr As String, _
  Optional ByVal objTextBox As Object, _
  Optional ByVal arrayDBFieldNo As Variant, _
  Optional ByVal arrayTextBoxNo As Variant) As Object
 
  Dim objTable, tmpTable As Object
  Dim i As Long
  With RSDOCMOD02.ConObj.SystemObject
    If .StartTable(TblName) Then
      Set objTable = .OpenedTable
        objTable.RecordId = SearchStr
        objTable.Read
        If objTable.Error = "0" Then
          Set tmpTable = objTable.record
        Else
          Set tmpTable = Nothing
        End If
        If objTable.IsOpen Then objTable.CloseFile
      Set objTable = Nothing
    End If
  End With
...........
..............


Pls offer advise n thanks alot.

~dirdar~
0
Comment
Question by:dirdar
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
IT-Schubertz earned 70 total points
ID: 10915951
Hi,

is it a module or a class?
If it's a module, try changing

 With RSDOCMOD02.ConObj.SystemObject

to

With ConObj.SystemObject

if it gives you an error go to the RSDOCMOD02 module and see, how ConObj is declared.
If it's not already set, please set it to Public.
Then run your code again.

Greetings

Andy
0
 

Author Comment

by:dirdar
ID: 10916266
Dear Andy,

I tried your solution, but it will give an error message "Variable Not Set" at imgLibrary module. It highlighted at the ConObj.SytemObject.

Fyi, the imgLibrary is reside in another project, named Project A.

In, RSDOCMOD02 module, it declared: -

Global ConObj As Object


Anyway, thanks for your kind advice.

~dirdar~
0
 
LVL 7

Expert Comment

by:IT-Schubertz
ID: 10916523
then you simply forgot to add the module from the other project to your project.
Right klick on your project, select add module and select existing module and select the RSDOCMOD02.bas.

This should do
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now