I'm using MSAccess 2003.
After someone has typed some text into a textbox, I want to use that text to create a directory in that name on my computer.
Obviously there are some characters that you cannot use like \ / * etc etc.
how can I check that these aren't used and if they are, stop them from exiting the text box until they rectify it?
I was trying this, but after it runs, it still exits the text box. and i'd have to write a line for EVERY character not allowed?!
VB Code:
Private Sub ProjectName_Exit(Cancel As Integer) If InStr(1, ProjectName.Value, "/") > 0 Then MsgBox ("/ character not allowed"): ProjectName.SetFocus If InStr(1, ProjectName.Value, "\") > 0 Then MsgBox ("\ character not allowed"): ProjectName.SetFocus If InStr(1, ProjectName.Value, ":") > 0 Then MsgBox (": character not allowed"): ProjectName.SetFocus If InStr(1, ProjectName.Value, "*") > 0 Then MsgBox ("* character not allowed"): ProjectName.SetFocus If InStr(1, ProjectName.Value, "?") > 0 Then MsgBox ("? character not allowed"): ProjectName.SetFocus If InStr(1, ProjectName.Value, "<") > 0 Then MsgBox ("< character not allowed"): ProjectName.SetFocus If InStr(1, ProjectName.Value, ">") > 0 Then MsgBox ("> character not allowed"): ProjectName.SetFocus If InStr(1, ProjectName.Value, "|") > 0 Then MsgBox ("| character not allowed"): ProjectName.SetFocus If InStr(1, ProjectName.Value, ",") > 0 Then MsgBox (", character not allowed"): ProjectName.SetFocus End Sub




Reply With Quote