Solved

Access Form -no spaces

Posted on 2014-04-24
2
335 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
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This article will show you how to use shortcut menus in the Access run-time environment.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

839 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