Re: vb6.exe closes randomly on W2000 Pro

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: mscir (mscir_at_usa.com)
Date: 08/12/04


Date: Wed, 11 Aug 2004 18:50:11 -0700

J French wrote:
> "Nina Harris" <sas@mailinator.com> wrote:
>>Ian wrote
>>>Can you please post the FileExists function code that you are using.
>>
>>Public Function FileExists(strDest As String) As Boolean
>> Dim intLen As Integer
>> If strDest <> vbNullString Then
>> On Error Resume Next
>> intLen = Len(Dir$(strDest))
>> On Error GoTo PROC_ERR
>> FileExists = (Not Err And intLen > 0)
>> Else
>> FileExists = False
>> End If
>>PROC_EXIT:
>> Exit Function
>>PROC_ERR:
>> MsgBox "Error: " & Err.Number & ". " & Err.Description, , _
>> "FileExists"
>> Resume PROC_EXIT
>>End Function
>
> That is pretty tangled code
> - /NEVER/ use Dir$() in a 'utilty function'

Can I ask what you mean by never using Dir$ in a 'utility function'? Are
you implying that Dir$ is somehow unreliable? I use Dir$ all the time
instead of FSO.

Mike



Relevant Pages

  • Re: Incorporating optional function argument
    ... If, for instance, you had MsgBox =Test or Debug.Print Test there would be something for the user to observe. ... Public Function test(strMsg As String, Optional blnVal As Boolean = False) ... A break point at the Public Function line does not result in the code breaking. ...
    (microsoft.public.access.formscoding)
  • Re: Incorporating optional function argument
    ... Public Function test(strMsg As String, Optional blnVal As Boolean = False) ... If I put this into the event property, ...
    (microsoft.public.access.formscoding)
  • Re: Command button to open form and find record
    ... Opens the form if it is not already open. ... Public Function OpenFormTo(strForm As String, strWhere As String, Optional bGotoNewRecord As Boolean, _ ... Optional strOpenArgs As String) As Boolean ... Public Function HasProperty ...
    (microsoft.public.access.forms)
  • Re: Incorporating optional function argument
    ... For now I have added the optional argument to the event property function calls. ... Public Function test(strMsg As String, Optional blnVal As Boolean = False) ...
    (microsoft.public.access.formscoding)
  • Re: How to tell if a form is open?
    ... > Public Function FrmIsLoaded(frm As String) As Boolean ... > Set prj = Application.CurrentProject ...
    (comp.databases.ms-access)