Solved

Unable to link to class module

Posted on 2002-06-18
3
193 Views
Last Modified: 2010-05-02
I'm currently writing a program that has module and several class modules. However I found that the main form coding unable to go to the appropriate section of the coding in one of the class module. The following is the main form coding where the reference is.

Sub new_archive()
        dlgNewArchive.Show 1, Me
    If dlgAccept Then
       comp.NewArchive rel.comfile, rel.comfold, rel.inc_file, rel.inc_subfold
       listview
    End If
End Sub


Here is the coding should be executed or referred:

Public Function NewArchive(CompFile As String, Rootfolder As String, IncludeFiles As Boolean, IncludeSubfolders As Boolean) As Long
    On Error Resume Next
    Screen.MousePointer = vbArrowHourglass
    Clear
    SetStatus csBusy
    xCompFileNew = CompFile
    xRootFolder = Rootfolder
    xExist = False
    If IncludeFiles Then
        ScanTree xRootFolder, IncludeSubfolders        
    End If
    xListView.SmallIcons = xIml      
    NewArchive = nFiles              
    Screen.MousePointer = vbNormal
    SetStatus csOK
End Function

When I perform step into of the debugging, as the debugger checks dlgAccept If statement, the line "comp.NewArchive rel.comfile, rel.comfold, rel.inc_file, rel.inc_subfold" is checked and then ignore with exiting the if statement. Is there any coding problem occurred here?

I hope to receive any comments ASAP.

Program_Viewer

0
Comment
Question by:program_viewer
[X]
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
3 Comments
 
LVL 2

Expert Comment

by:corvanderlinden
ID: 7091885
Suggestion :

Sub new_archive()

On error goto errh

   dlgNewArchive.Show 1, Me
   If dlgAccept Then
      comp.NewArchive rel.comfile, rel.comfold, rel.inc_file, rel.inc_subfold
      listview
   End If

exit sub

errh:
 MsgBox err.description
end sub
0
 

Expert Comment

by:fdcjat
ID: 7092304
Always use "On Error Goto ..." in every Sub or Function.

Vital error information may be lost due to VB's error handling schema.

So:

Public Function NewArchive(CompFile As String, Rootfolder As String, IncludeFiles As Boolean, IncludeSubfolders
As Boolean) As Long
   'On Error Resume Next
   On error goto errh
   Screen.MousePointer = vbArrowHourglass
   Clear
   SetStatus csBusy
   xCompFileNew = CompFile
   xRootFolder = Rootfolder
   xExist = False
   If IncludeFiles Then
       ScanTree xRootFolder, IncludeSubfolders        
   End If
   xListView.SmallIcons = xIml      
   NewArchive = nFiles              
   Screen.MousePointer = vbNormal
   SetStatus csOK

exit function

errh:
MsgBox err.number & ": " & err.description
' Or any other error handling !

End Function
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 60 total points
ID: 7092349
have you created an instance of your class (i assume that your instance is Dimmed as :

Dim comp as MyClass
set comp = New MyClass

?

Have you included Option Explicit at the top of the Declaration section on Each form.  I ask these rather basic questions, because I do not see the direct evidence of either being the case, from the code that you have shown.

Arthur Wood
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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 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…

740 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