Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to set an object, that passed from a module

Posted on 2004-04-25
5
145 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

829 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