|
-
Nov 15th, 2006, 01:21 AM
#1
Thread Starter
Lively Member
[RESOLVED] Create Directory/Folder
Here's my form code:
VB Code:
Private Sub cmdUpdate_Click()
On Error GoTo errorHandler:
Call fileOutput(Me, 0)
x = MsgBox("Record updated.", vbInformation + vbOKOnly, "Update")
Call mdlMain.clear(Me)
dtpDateFrom.SetFocus
errorHandler:
FileErrors
module code(fileOutput function):
VB Code:
dfrom = frmref.dtpDateFrom.Value
dto = frmref.dtpDateTo.Value
addOne = Format(DateAdd("d", 1, dto), "YYYYMMDD")
'copy textfile content to another texfile
Open "C:\Upload\NewClient.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, sLines
mydate = Left(sLines, 12)
If Format(dfrom, "YYYYMMDD") <= mydate And mydate < addOne Then
Output = Output & vbCrLf & sLines
End If
DoEvents
Loop
Close #1
'write in textfile
Open "c:\Update\NewClient.txt" For Output As #1
Print #1, Output
Close #1
error trapping:
VB Code:
Public Const mnErrPathDoesNotExist = 76
Public Function FileErrors() As Integer
Select Case Err.Number
Case mnErrPathDoesNotExist ' Error 76
strMsg = "The path or file you are trying to access doesn't exist."
strMsg = strMsg & vbCrLf & "It maybe renamed, moved or deleted."
strMsg = strMsg & vbCrLf & "Please contact your administrator."
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|