Solved

Unable to link to class module

Posted on 2002-06-18
3
185 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
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 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

22 Experts available now in Live!

Get 1:1 Help Now