Results 1 to 6 of 6
  1. #1
    billgyrotech1 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    May 2019
    Posts
    179

    Allowed Entry Formats

    Hello,



    I have a PO # field that can have 3 different types of data entered:

    P-56589
    (If the part came from a purchase order number)

    W2003:001
    (If the part came from a house work order number)

    AFR55555
    (If the part came from an AFR number)

    Is there a way to ensure no spaces are entered by the user or spaces removed when they leave the field?

    Thank you,
    Bill

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You can do this type of thing (I think that's the right code for a space):

    Code:
    Private Sub txtRequestor_KeyPress(KeyAscii As Integer)
      Select Case KeyAscii
        Case 32
          KeyAscii = 0
        Case Else    
          KeyAscii = KeyAscii
      End Select
    
    
    End Sub
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    billgyrotech1 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    May 2019
    Posts
    179
    I put it in the key press event but it doesn't work for taking out spaces sorry.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It doesn't take them out, it prevents them from being entered. I just tested and it worked as expected.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    billgyrotech1 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    May 2019
    Posts
    179
    Thanks pbaldy it does work I was entering the code incorrectly.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problemo.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Set Allowed Values for A Textbox
    By Richard_Marx in forum Forms
    Replies: 3
    Last Post: 08-16-2016, 06:28 AM
  2. No Editing allowed
    By lugnutmonkey in forum Access
    Replies: 1
    Last Post: 02-17-2013, 07:31 AM
  3. data entry not allowed in subform?
    By Lyndy in forum Forms
    Replies: 4
    Last Post: 08-22-2012, 10:28 PM
  4. Not Allowed To Run Delete Query
    By batowl in forum Queries
    Replies: 5
    Last Post: 01-27-2011, 03:43 PM
  5. Two fields not allowed in Report
    By normie in forum Reports
    Replies: 1
    Last Post: 07-10-2010, 04:40 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