Solved

Unable to link to class module

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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