Troubles Using The Mkdir Command

err75 in vb when attempting to mkdir

Page 1 of 1

8 Replies - 7536 Views - Last Post: 20 February 2009 - 07:13 PM Rate Topic: -----

#1 JesseFender   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 18-February 09

Troubles Using The Mkdir Command

Posted 18 February 2009 - 09:59 PM

Ok im stuck and maybe some one could give helpful advice... i am wanting to make a folder to tuck a few .log files away into, when i attempt to run the program it pops up an error and will do the msg box, but will only display 0 and what i told it to also include... i am new to vb as i have nothing but my own trial and error and friendly help from those who know more than i do.

this is the cofe, the part that really applies to the issue at hand is the first 8 lines under the private Sub form_load(). *** he error is 75 file path not valid

 Private Sub Form_Load()
[font=Century Gothic]
MkDir ("c:/program files/goober")
On Error Resume Next
MsgBox Err.Number & Err.Description & ". Please contact up to get help with this issue."
MkDir ("c:/program files/goober/logs")
On Error Resume Next
MsgBox Err.Number & Err.Description & ". Please contact us to get help with this issue"[/font]
Command2.Caption = "&Admin." 'assigns the hotkey for the admin panel.


this is the rest of the code.
Combo1.Text = "Plese select an option" 'sets the text in the combo boxes
Combo2.Text = "Please select from the above"
Combo1.AddItem "Paradise" 'adds the towns avil, for trading speakers with in the circut.
Combo1.AddItem "Chico"
Combo1.AddItem "Oroville"
Combo1.AddItem "Corning"
Combo1.AddItem "Greenville"
Combo1.AddItem "Quincy"
Combo1.AddItem "Portola"
Combo1.AddItem "Chester"

Form1.Visible = False 'sets the first visibleity of on load
Form2.Visible = True 'shows the EULA
Form3.Visible = False 'EULA shows the key activation
Form4.Visible = False 'Admin panel login is of course not vis on load
Form5.Visible = False 'admin panel is hidden on load

Command1.Caption = "&Close" 'sets a hotkey for command1
'checks for log files, and then the contence... too much to do all here...
Dim eula As Object 'sets eula or act as dim var
Set eula = CreateObject("Scripting.FileSystemObject") 'set vars to a task

If eula.FileExists(App.Path & "\eula.log") Then 'checks if .log file exists
 Dim eula_check As String 'sets a var for checking the file
 Dim eula_counter As Long 'sets a counter var  i am not sure why i need it but i do...
eula_counter = 1 'sets val of counter var
  Open (App.Path & "\eula.log") For Input As #254 'opens .log files
Do While Not EOF(254) 'i dont really know, is loop though...:)
		Line Input #254, eula_check 'checks for values in the .log file
		eula_table(1, eula_counter) = eula_check 'uses table set in general decs that declaire the val of the .log check var
		eula_counter = eula_counter + 1 'val counter var add 1 sets position in table
Loop 'loop!!! this well loops the above function untill end
   Close #254 'closes the file
End If 'ends teh if statement
eula_check = "no" 'check var = null
For x = 1 To eula_counter 'sets counter var to a new var
	If eula_table(1, x) = Environ$("username") Then 'looks to see if .log file has stuff put there.
	Form2.Check1.Value = 1 'set to true, means it was checked.
	Form2.Visible = False 'hides form
	Form2.Enabled = False 'turns off form
	Exit For 'ends the for statement
End If 'ends if statement
Next x 'clears var 'x' so can be used elsewhere
x = 0 'set x to 0... dont know why.

'same as above with minor changes... this form makes visible themain form.
Dim act As Object 'uses act instead of eula
Set act = CreateObject("Scripting.FileSystemObject")

If act.FileExists(App.Path & "\act.log") Then
 Dim act_check As String
 Dim act_counter As Long
act_counter = 1
  Open (App.Path & "\act.log") For Input As #244
Do While Not EOF(244)
		Line Input #244, act_check
		act_table(1, act_counter) = act_check
		act_counter = act_counter + 1
Loop
   Close #244
End If
act_check = "no"
For n = 1 To act_counter 'uses 'n' instead of 'x'
	If act_table(1, n) = Environ$("username") Then
	Form3.Check1.Value = 1
	Form3.Visible = False
	Form3.Enabled = False
	Form1.Visible = True
	Form1.Enabled = True
	Exit For
End If
Next n
n = 0
End Sub



Moderator Note: Edited topic title to be more descriptive.
- Core

This post has been edited by Core: 20 February 2009 - 07:27 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Troubles Using The Mkdir Command

#2 luigiplumbersinc   User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 82
  • Joined: 16-February 09

Re: Troubles Using The Mkdir Command

Posted 18 February 2009 - 10:52 PM

ahhhhhhhhhhhhhhhhhhhhhhhh perhaps you should consider editing and proof reading your post /cry


and your use of On Error Resume Next is odd... i do believe its an option like Option Explicit so if there is an error it will simply ignore that line and move to the next bit of code... not really what you want in your case as you clearly have an erro when creating your directories

so perhaps remove that... if when there is an error it indeed returns the Err object then rather than using On Error Resume Next followed by a message box first find out the initial value for Err if there is one and try a few things to get something like this working

if Err.Number = ValidErrorNumber Then 'Not an actual VB Variable you will have to define this when you find what you need
	MsgBox Err.Number & Err.Description & ". Please contact up to get help with this issue."
end if



same goes for the next MsgBox... if this doesnt answer your question its because i have no idea what "private dec" is ><

PLEEEASE EDIT YOUR POST

GoodLucl :D
Was This Post Helpful? 0
  • +
  • -

#3 Dr. Fox   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 12
  • Joined: 02-March 08

Re: Troubles Using The Mkdir Command

Posted 18 February 2009 - 11:54 PM

I'm guessing you mean the Private Declaration of Form_Load by "Private dec"

First things first, On Error Resume Next is a command that simply tells the compiler to ignore all errors for the remainder of the subroutine... which doesn't appear to be your intent with it.

I would remove the On Error Resume Next statements right away, as they'll make your code a debugging nightmare as far as I can tell.

The good news is I think because you have the On Error command after you're first mkdir, there must not have been an error in it because the code did not break. And someone correct me if I'm wrong (I don't VB often) but if MsgBox Err.Number give a 0, there isn't any error is there?

I would say, change this:
MkDir ("c:/program files/goober")
On Error Resume Next
MsgBox Err.Number & Err.Description & ". Please contact up to get help with this issue."
MkDir ("c:/program files/goober/logs")
On Error Resume Next
MsgBox Err.Number & Err.Description & ". Please contact us to get help with this issue"


to

MkDir "c:/program files/goober"
MkDir "c:/program files/goober/logs"


I only looked at the first 8 lines, but in that much, I don't think you have any problems, other than your use of parentheses.
Was This Post Helpful? 0
  • +
  • -

#4 JesseFender   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 18-February 09

Re: Troubles Using The Mkdir Command

Posted 20 February 2009 - 12:05 AM

Ok i made the following changes:

Private Sub Form_Load()
ChDir "c:/program files/"
MkDir "goober"
ChDir "c:/program files/goober/"
'On Error Resume Next
'MsgBox Err.Number & Err.Description & ". Please contact up to get help with this issue."
MkDir "logs"
'On Error Resume Next
'MsgBox Err.Number & Err.Description & ". Please contact us to get help with this issue"

whereami = "c:/program files/goober/logs/" 'as stated under General declarations is  "Public whereami As String" sets this up to be a flexible variable to load the logs to the file destination made above...



upon which i recieve an err 75, which is a path/file access error. it is still telling me that i cannot make a directory. i am the admin on the system and i should be able to make the folder... im lost from here on out. this has consumed more time than i would like it to have but now i cant rest untill i know how to do it. any help in addition would be greatly helpful. and thank you all for the help and advice that you have given me so far...

Jesse Fender

This post has been edited by JesseFender: 20 February 2009 - 12:11 AM

Was This Post Helpful? 0
  • +
  • -

#5 luigiplumbersinc   User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 82
  • Joined: 16-February 09

Re: Troubles Using The Mkdir Command

Posted 20 February 2009 - 02:40 AM

maybe you should try removing all that code and just using this...
MkDir ("C:\Program Files\goober")
MkDir("C:\Program Files\goober\logs")



you may even be able to do this with 1 line of code like so

MkDir("C:\Program Files\goober\logs")



sorry if the error persists... please contact me...

goodluck :D
Was This Post Helpful? 0
  • +
  • -

#6 JesseFender   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 18-February 09

Re: Troubles Using The Mkdir Command

Posted 20 February 2009 - 07:43 AM

View Postluigiplumbersinc, on 20 Feb, 2009 - 01:40 AM, said:

you may even be able to do this with 1 line of code like so

MkDir("C:\Program Files\goober\logs")



sorry if the error persists... please contact me...

goodluck :D


Nope error persists to state that "'75' file/path access error"
Private Sub Form_Load()

MkDir ("c:/program files/goober/logs")


i dont know...
Was This Post Helpful? 0
  • +
  • -

#7 luigiplumbersinc   User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 82
  • Joined: 16-February 09

Re: Troubles Using The Mkdir Command

Posted 20 February 2009 - 10:55 AM

well thats weird
i have another option
put a .bat file called "makeGoober.bat" in the same folder as your VB application and put inside the following line
mkdir C:\Program Files\goober\logs\


to call this use
Shell(App.Path & "\makeGoober.bat")



if that doesnt work.... check your privileges O.o
Was This Post Helpful? 0
  • +
  • -

#8 Dr. Fox   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 12
  • Joined: 02-March 08

Re: Troubles Using The Mkdir Command

Posted 20 February 2009 - 05:12 PM

Try:

mkdir "C:\Something Else\goober"

I'm betting it's the permissions related to the app path.
Was This Post Helpful? 1
  • +
  • -

#9 JesseFender   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 18-February 09

Re: Troubles Using The Mkdir Command

Posted 20 February 2009 - 07:13 PM

It worked,,, program files was set to read only. all fixed thank you!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1