Re: ErrorMessage when file is missing

From: Jim Edgar (djedgarNOSPAM_at_cox.net)
Date: 12/26/04


Date: Sun, 26 Dec 2004 10:07:56 -0800


> Dim Kildefil as object
>
> Kildefil = "H:\dbBil\dbBil.mdb"
>
> if not Dir(Kildefil)) Then
> else
> Msgbox("Can't find file!",msgboxstyle.information,conMelding)
> end if
>
> I get this error when file is missing.
>
> Change form string to type Long is not legal.
> regards
> reidarT
>
>

The Dir() function returns a string and the syntax you used
*may* be trying to coerce the string to a long. Try this
syntax:

If Dir(Kildefil) <> "" Then
    ' Found the file
Else
    ' File not found
    Msgbox("Can't find file!",msgboxstyle.information,conMelding)
End If

HTH,

J Edgar



Relevant Pages

  • ssl win library and sspi example compiling questions
    ... I made a project for the server and for the client, ... error: missing ')' before 'string' ...
    (microsoft.public.platformsdk.security)
  • Re: inconsistent behavior of >FLOAT
    ... If the string represents a valid floating-point number in the syntax ... if the string does not match the syntax given then false ... ">FLOAT enables programs to read floating-point data in legible ASCII format. ...
    (comp.lang.forth)
  • Re: Just a bit of silliness
    ... Is that the syntax and grammar resemble the stammer ... Can't guess how to copy a string. ... Is the very last} "close curly bracket" ... format strings. ...
    (comp.lang.c)
  • Problems Managing Required Field and Form Events
    ... Dim CheckVal As String ... If CheckVal = "Missing" Then ... Private Sub Form_BeforeUpdate ... Do you want to close the database object anyway? ...
    (microsoft.public.access.formscoding)
  • Problems Managing Required Field and Form Events
    ... Dim CheckVal As String ... If CheckVal = "Missing" Then ... Private Sub Form_BeforeUpdate ... Do you want to close the database object anyway? ...
    (microsoft.public.access.formscoding)