Results 1 to 6 of 6

Thread: [RESOLVED] On Exit textbox function. check entry??

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2004
    Location
    Surrey, UK
    Posts
    163

    Resolved [RESOLVED] On Exit textbox function. check entry??

    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:
    1. Private Sub ProjectName_Exit(Cancel As Integer)
    2. If InStr(1, ProjectName.Value, "/") > 0 Then MsgBox ("/ character not allowed"): ProjectName.SetFocus
    3. If InStr(1, ProjectName.Value, "\") > 0 Then MsgBox ("\ character not allowed"): ProjectName.SetFocus
    4. If InStr(1, ProjectName.Value, ":") > 0 Then MsgBox (": character not allowed"): ProjectName.SetFocus
    5. If InStr(1, ProjectName.Value, "*") > 0 Then MsgBox ("* character not allowed"): ProjectName.SetFocus
    6. If InStr(1, ProjectName.Value, "?") > 0 Then MsgBox ("? character not allowed"): ProjectName.SetFocus
    7. If InStr(1, ProjectName.Value, "<") > 0 Then MsgBox ("< character not allowed"): ProjectName.SetFocus
    8. If InStr(1, ProjectName.Value, ">") > 0 Then MsgBox ("> character not allowed"): ProjectName.SetFocus
    9. If InStr(1, ProjectName.Value, "|") > 0 Then MsgBox ("| character not allowed"): ProjectName.SetFocus
    10. If InStr(1, ProjectName.Value, ",") > 0 Then MsgBox (", character not allowed"): ProjectName.SetFocus
    11.  
    12. End Sub
    Last edited by strobinson1; Sep 23rd, 2005 at 05:59 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width