?
Solved

Access Form -no spaces

Posted on 2014-04-24
2
Medium Priority
?
347 Views
Last Modified: 2014-04-25
Hello All,

I have users fill several tables via forms. Now when they are entering fieldA, - they cant enter words with spaces in them - for example:

good boy - not allowed

goodboy - allowed

how do i do that vba event to control that restriction

Rayne
0
Comment
Question by:Rayne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 40022133
Are users allowed to enter ONLY a single word in the area you want to control? Or can they enter free form text?

If they can only enter a single word, then you could simply use the BeforeUpdate event of that control to validate it:
Sub MyControl_BeforeUpdate(Cancel As Integer)
  If Instr(1, Me.MyControl.Text, " ") > 0 Then
    Msgbox "You cannot enter spaces"
    Cancel = True
  End If
End Sub

Open in new window

If you allow free form text, then I don't see how you could control that unless you can come up with a listing of accepted (or rejected) words. You could then compare each two-word combo to that and reject any that are found. I can see a LOT of trouble with that, however.
0
 

Author Closing Comment

by:Rayne
ID: 40023287
Thank you Scott :)
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question