VB 6 Error 75 Path File Access

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jun 2004
Posts: 2
Reputation: Zooker is an unknown quantity at this point 
Solved Threads: 0
Zooker Zooker is offline Offline
Newbie Poster

VB 6 Error 75 Path File Access

 
0
  #1
Oct 24th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 914
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 167
vb5prgrmr vb5prgrmr is offline Offline
Posting Shark
 
0
  #2
Oct 24th, 2009
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
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum


Views: 390 | Replies: 1
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC