Re: How do you tell if a folder exists
From: Ayaz Ahmed (ayaz_at_csquareonline.com)
Date: 03/29/04
- Next message: J French: "Re: How to remotely activate Ctrl-C ?"
- Previous message: Ayaz Ahmed: "Re: Checkbox in ListView"
- In reply to: Anthony: "How do you tell if a folder exists"
- Next in thread: J French: "Re: How do you tell if a folder exists"
- Reply: J French: "Re: How do you tell if a folder exists"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 29 Mar 2004 03:08:17 -0800
Hello,
Private Sub pictselect_Click()
Dim b As Scripting.FileSystemObject
Set b = New Scripting.FileSystemObject
Dim objrs As ADODB.Recordset
Set objrs = New ADODB.Recordset
Dim strsql As String
Dim NewPictureFileName As String
Dim Pathname1, Pathname2, DestinationFolderPath As String
DestinationFolderPath = App.Path & "\Pictures"
NewPictureFileName = frmInfoSystemMain.cmbSGRNo.Text & "." &
b.GetExtensionName(FilesList.FileName)
Pathname1 = DirctoryLIST.Path & "\" & FilesList.FileName
Pathname2 = App.Path & "\Pictures\" & NewPictureFileName
If FilesList.FileName = "" Then
Exit Sub
ElseIf NewPictureFileName = "" Then
Exit Sub
End If
If b.FolderExists(DestinationFolderPath) = True Then
b.CopyFile Pathname1, Pathname2, True
Else
user_Choice = MsgBox("The PICTURES folder does not exist. Do you
want to create this folder?", vbInformation + vbYesNo +
vbDefaultButton1, "Alert")
If user_Choice = vbYes Then
b.CreateFolder (DestinationFolderPath)
b.CopyFile Pathname1, Pathname2, True
Else
MsgBox "Unable to select picture for this Student.",
vbInformation, "Alert"
Unload Me
Exit Sub
End If
End If
strsql = "Select * from Students where G_R_Number = " &
frmInfoSystemMain.cmbSGRNo
If frmInfoSystemMain.cmbSGRNo.Text = "" Then
MsgBox "Unable to select picture for this Student. No Gr. Number is
selected.", vbInformation, "Alert"
Exit Sub
End If
If IsNumeric(frmInfoSystemMain.cmbSGRNo.Text) = False Then
MsgBox "Gr. Number must be Numeric.", vbInformation, "Alert"
Exit Sub
End If
objrs.Open strsql, objconn, adOpenKeyset, adLockOptimistic
objrs.MoveFirst
objrs.Fields("Picture_PathName") = NewPictureFileName
objrs.Update
objrs.Close
Set objrs = Nothing
frmInfoSystemMain.PicStudent.Picture = LoadPicture(App.Path &
"\Pictures\" & NewPictureFileName)
Unload Me
End Sub
Thanks,
Warm Regards,
Ayaz Ahmed
Software Engineer & Web Developer
Creative Chaos (Pvt.) Ltd.
"Managing Your Digital Risk"
http://www.csquareonline.com
Karachi, Pakistan
Mobile +92 300 2280950
Office +92 21 455 2414
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
- Next message: J French: "Re: How to remotely activate Ctrl-C ?"
- Previous message: Ayaz Ahmed: "Re: Checkbox in ListView"
- In reply to: Anthony: "How do you tell if a folder exists"
- Next in thread: J French: "Re: How do you tell if a folder exists"
- Reply: J French: "Re: How do you tell if a folder exists"
- Messages sorted by: [ date ] [ thread ]