Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.basic.visual.misc > #1826 > unrolled thread
| Started by | GS <gs@somewhere.net> |
|---|---|
| First post | 2011-02-02 20:57 -0500 |
| Last post | 2011-02-03 05:34 -0600 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.basic.visual.misc
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Renaming a Directory in VB6???? GS <gs@somewhere.net> - 2011-02-02 20:57 -0500
Re: Renaming a Directory in VB6???? "jason@smkzone.com" <jbodine1@yahoo.com> - 2011-02-03 02:22 -0800
Re: Renaming a Directory in VB6???? "David Youngblood" <dwy@flash.net> - 2011-02-03 05:34 -0600
| From | GS <gs@somewhere.net> |
|---|---|
| Date | 2011-02-02 20:57 -0500 |
| Subject | Re: Renaming a Directory in VB6???? |
| Message-ID | <iid20t$6cm$1@news.eternal-september.org> |
jason@smkzone.com presented the following explanation :
> Hi all!
>
> On the current program I'm working on (which we've been discussing in
> the thread "Problem With ADO in VB6" ), I've run into a bit of a snag
> with some code that won't work, and I'm not quite sure why it isn't!
>
> I'm working on a Time Clock program for a business. On the main form,
> I have 2 buttons, labeled "Begin New Pay Period" and "End Current Pay
> Period," respectively. I have managed to create a new Directory
> (empty, as yet, since I have not yet created any files to put in it)
> by pressing the "Begin New Pay Period" button with the following code:
>
> Public Sub BeginNewPP()
> If frmTimeClock.dtpEnd.Value > frmTimeClock.dtpStart.Value Then
> Dim folder As String, folder2 As String, fName As String, fName2 As
> String
> fPath = App.Path & "\"
> folder = "Pay Period"
> fName = Dir(fPath & folder, vbDirectory)
> If fName = "" Then
> MkDir fPath & folder
> ChDir folder
> folder2 = "\Current"
> fName2 = Dir(fPath & folder & folder2, vbDirectory)
> If fName2 = "" Then
> MkDir fPath & folder & folder2
> Else
> MsgBox "You must end the current pay period first!",
> vbOKOnly, "Pay Period In Progress!"
> Exit Sub
> End If
> Else
> ChDir fPath & folder
> folder2 = "\Current"
> fName2 = Dir(fPath & folder & folder2, vbDirectory)
> If fName2 = "" Then
> MkDir fPath & folder & folder2
> Else
> MsgBox "You must end the current pay period first!",
> vbOKOnly, "Pay Period In Progress!"
> Exit Sub
> End If
> End If
> Else
> MsgBox "You must select a valid Start Date and End Date!",
> vbOKOnly, "Error!"
> Exit Sub
> End If
> End Sub
>
> The code for the other one, which is intended to renamed the
> subdirectory "Current" which was created by the first sub to a
> different name, refuses to work for some odd reason. Every time I run
> it, I get "Run-time Error 53: File Not Found."
>
> Here's the problem code:
>
> Public Sub EndCurrPP()
> Dim folder As String, folder2 As String, fName As String, fName2 As
> String
> fPath = App.Path & "\"
> folder = "Pay Period"
> folder2 = "\Current"
> fName = Dir(fPath & folder & folder2, vbDirectory)
> If fName = "" Then
> MsgBox "No current Pay Period is active!", vbOKOnly, "Error!"
> Exit Sub
> Else
> If frmTimeClock.dtpEnd.Value > frmTimeClock.dtpStart.Value Then
> Dim Confirm
> Confirm = MsgBox("This will end the current pay period!
> Continue?", vbYesNo, "Confirmation Required!")
> Select Case Confirm
> Case vbYes
> fName2 = frmTimeClock.dtpStart.Value & " through " &
> frmTimeClock.dtpEnd.Value
>
> Name App.Path & "\Pay Period\" & "Current" As App.Path &
> "\Pay Period\" & fName2
> Exit Sub
> Case vbNo
> Exit Sub
> End Select
> Else
> Exit Sub
> End If
> End If
> End Sub
>
> Thanks for your time!
> Jason
The function thinks you're renaming a file because the trailing
backslash is missing.
--
Garry
Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
[toc] | [next] | [standalone]
| From | "jason@smkzone.com" <jbodine1@yahoo.com> |
|---|---|
| Date | 2011-02-03 02:22 -0800 |
| Message-ID | <4e20d437-1a2c-4812-a803-55d3121f5600@o7g2000prn.googlegroups.com> |
| In reply to | #1826 |
Garry: I just tried adding the trailing backslash. I'm still getting that runtime error 53. Jason > > The function thinks you're renaming a file because the trailing > backslash is missing. >
[toc] | [prev] | [next] | [standalone]
| From | "David Youngblood" <dwy@flash.net> |
|---|---|
| Date | 2011-02-03 05:34 -0600 |
| Message-ID | <iie3st$rf6$1@news.eternal-september.org> |
| In reply to | #1839 |
"jason@smkzone.com" <jbodine1@yahoo.com> wrote in message news:4e20d437-1a2c-4812-a803-55d3121f5600@o7g2000prn.googlegroups.com... > Garry: > > I just tried adding the trailing backslash. I'm still getting that > runtime error 53. > What are you getting from the datetime picker control. These characters are invalid in file/folder names: \ / : * ? < > |. I would suspect that the text you are getting from the control has one or more of those characters. David
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.basic.visual.misc
csiph-web