Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can i have the msgbox in the right place???

Status
Not open for further replies.

miketamp

Technical User
Jan 28, 2005
20
GR
HI
i have a form which has a textbox "Ctl6" also i have a button "mkdir". I want when the "Ctl6" takes the value and if i press the "mkdir" to create a folder with the value name. and then in the new folder to create two folders every time the folders :"man" and "woman" but when the "Ctl6" is empty then to show a message.
i' ve rote this code :
Private Sub mkdir_Click()

Dim mypath
mypath = ("C:\Program Files\diet\diets\express\")

If Ctl6.AfterUpdate = "" Then
MsgBox "the box is emty", vbInformation, "wrong input"
ElseIf Ctl6.Value Is Not Null Then
MkDir (mypath & Me.[Ctl6])
MkDir (mypath & Me.[Ctl6] \ man)
MkDir (mypath & Me.[Ctl6] \ woman)
End If
End Sub

The problem that every time even if the "ctl6" is not empty i have the Msbox message in my screen and noone folder is created.
is the code correct? what's wrong?
Also can you please tell me if the mkdir command is typed ok to create a standard name subfolders after that the form creates a folder without standard name?
thanx...
 
Try:

[tt]If trim$(me!Ctl6.value & "") = "" Then
MsgBox "the box is emty", vbInformation, "wrong input"
Else[/tt]

I wonder if also some quotes could be useful, too

[tt] MkDir (mypath & Me.[Ctl6])
MkDir (mypath & Me.[Ctl6] & " \man")
MkDir (mypath & Me.[Ctl6] & "\woman")[/tt]

Roy-Vidar
 

hi RoyVidar. thanx for your reply
the msgbox works if the first line is :
If trim$(Ctl6.value & "") = "" Then
without "me!"
but i still have problem to create the subfolders
man & woman
any sugestions?? please help....
 
See if this works.

Code:
   If Ctl6.Value = "" Or IsNull(Ctl6.Value) Then

   MsgBox "the box is emty", vbInformation, "wrong input"

   Else
          MkDir (mypath & Me.[Ctl6])
          MkDir (mypath & Me.[Ctl6] \ man)
          MkDir (mypath & Me.[Ctl6] \ woman) 
   End If
Hope this helps
 
MkDir mypath & [Ctl6] & IIf(Right$([Ctl6], 1) = "\", "", "\") & "man"
MkDir mypath & [Ctl6] & IIf(Right$([Ctl6], 1) = "\", "", "\") & "woman"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top