943,998 Members | Top Members by Rank

Ad:
Oct 24th, 2009
0

VB 6 Error 75 Path File Access

Expand Post »
The error occured in this program after I changed to option explicit
and got rid of all the dollar signs and percent signs and switched to 10 or 12 character variables as showed in MSB Exaples!!
Public Sub CreateDir()
Drv = App.Path
ChDir Drv
Select Case intRegg
Case 1
Message box Placed Here showed the correct Path was Chosen so why did I get this stupid error?
Flow = Drv + "\CHXPLUS1"
MkDir Flow
Case 2
Flow = Drv + "\CHXPLUS2\"
MkDir Flow
Case 3
Flow = Drv + "\CHXPLUS3\"
MkDir Flow
Case 4
Flow = Drv + "\CHXPLUS4\"
MkDir Flow
Case 5
Flow = Drv + "\CHXPLUS5\"
MkDir Flow
Case 6
Flow = Drv + "\CHXPLUS6\"
MkDir Flow
Case Else
End Select
WriteFiles 1, 1, 0
Back2_3 4
End Sub
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Zooker is offline Offline
2 posts
since Jun 2004
Oct 24th, 2009
0
Re: VB 6 Error 75 Path File Access
Okay, let first start by reminding you of code tags...

Then let me say where are you getting this error? What line and what are the state of your variables?

Next up is how do you add, i.e. the use of addition, two string together? (Sarcastic, yes, I know). But in reality you concatinate two string together by the use of the ampersand character (&)...

String1 = String1 & String2

Another thing I noticed is in the first case you have "\path" but in the second and thereafter cases you have "\path\"
Public Sub CreateDir()
Drv = App.Path
If Right(Drv, 1) = "\" Then Drv = Left(Drv, Len(Drv) - 1) 'chop off any trailing back slash as you have seemed to include it below in your code so as to avoid a double backslash in the path "\\"
ChDir Drv
Select Case intRegg
Case 1 
  Flow = Drv & "\CHXPLUS1"
Case 2
  Flow = Drv & "\CHXPLUS2"
Case 3
  Flow = Drv & "\CHXPLUS3"
Case 4
  Flow = Drv & "\CHXPLUS4"
Case 5
  Flow = Drv & "\CHXPLUS5"
Case 6
  Flow = Drv & "\CHXPLUS6"
End Select
MkDir Flow
WriteFiles 1, 1, 0
Back2_3 4
End Sub

Also, I removed all of your mkdir statements since the select case is only used to build the path and put the mkdir statement after the select case to shorten your code.

Then I removed your case else as you had no code there so no need for the case else.

Now, finally, if you are using this code on vista then that is your problem as the C:\Program Files\AppName folder is protected. Please see this thread...

http://www.vbforums.com/showthread.p...02#post2807202

for changes you need to make to your program.



Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: What Could be wrong here!!!
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Plz, Correct this Code





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC