Results 1 to 8 of 8

Thread: [RESOLVED] Create Directory/Folder

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2006
    Posts
    81

    Resolved [RESOLVED] Create Directory/Folder

    Here's my form code:
    VB Code:
    1. Private Sub cmdUpdate_Click()
    2.  
    3. On Error GoTo errorHandler:
    4.  
    5.         Call fileOutput(Me, 0)
    6.         x = MsgBox("Record updated.", vbInformation + vbOKOnly, "Update")
    7.         Call mdlMain.clear(Me)
    8.         dtpDateFrom.SetFocus
    9.  
    10. errorHandler:
    11.     FileErrors

    module code(fileOutput function):
    VB Code:
    1. dfrom = frmref.dtpDateFrom.Value
    2.         dto = frmref.dtpDateTo.Value
    3.         addOne = Format(DateAdd("d", 1, dto), "YYYYMMDD")
    4.        
    5.         'copy textfile content to another texfile
    6.         Open "C:\Upload\NewClient.txt" For Input As #1
    7.         Do While Not EOF(1)
    8.             Line Input #1, sLines
    9.                 mydate = Left(sLines, 12)
    10.                 If Format(dfrom, "YYYYMMDD") <= mydate And mydate < addOne Then
    11.                     Output = Output & vbCrLf & sLines
    12.                 End If
    13.         DoEvents
    14.         Loop
    15.         Close #1
    16.        
    17.         'write in textfile
    18.         Open "c:\Update\NewClient.txt" For Output As #1
    19.         Print #1, Output
    20.         Close #1

    error trapping:
    VB Code:
    1. Public Const mnErrPathDoesNotExist = 76
    2.  
    3. Public Function FileErrors() As Integer
    4.     Select Case Err.Number
    5.         Case mnErrPathDoesNotExist              ' Error 76
    6.             strMsg = "The path or file you are trying to access doesn't exist."
    7.             strMsg = strMsg & vbCrLf & "It maybe renamed, moved or deleted."
    8.             strMsg = strMsg & vbCrLf & "Please contact your administrator."
    9.             intMsgType = vbExclamation + vbOKOnly


    These codes are running already. When I don't call errorHandler/fileError, the VB6 program automatically create "C:\Update". But when there's error trapping mnErrPathDoesNotExist appears.

    How will I create "C:\Update" even with error trapping?
    Last edited by ayionick; Nov 15th, 2006 at 01:39 AM. Reason: Resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width