Results 1 to 3 of 3
  1. #1
    mrbabji is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2010
    Posts
    12

    Not to allow spaces in textbox

    Hi



    Please help me in setting textbox property to not to allow any spaces in the text we type.

    Thanks & Regards

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    The easiest way is to turn on KeyPreview for the Form and then kill the space in the KeyDown Event.
    Code:
    Private Sub YourControl_KeyDown(KeyCode As Integer, Shift As Integer)
        If KeyCode = 32 Then    '-- the Space bar
           KeyCode = 0          '-- Just kill the key
    '      KeyCode = 7         '-- Or maybe change it to a beep
       End If
    End Sub

  3. #3
    mrbabji is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2010
    Posts
    12
    Thanks a lot

Please reply to this thread with any new information or opinions.

Similar Threads

  1. VBA Code (spaces)
    By Rich P in forum Access
    Replies: 1
    Last Post: 03-07-2011, 01:57 PM
  2. two spaces to one without VB code ?
    By techexpressinc in forum Queries
    Replies: 4
    Last Post: 10-06-2010, 02:40 PM
  3. Trailing Spaces workaround
    By shexe in forum Queries
    Replies: 23
    Last Post: 09-21-2010, 04:28 AM
  4. Line Spaces in Sql View
    By Matthieu in forum Access
    Replies: 1
    Last Post: 04-06-2010, 10:24 AM
  5. Deleting Spaces
    By grgerhard in forum Import/Export Data
    Replies: 2
    Last Post: 04-30-2006, 06:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums