Solved

Access Form -no spaces

Posted on 2014-04-24
2
331 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Outlook 2010 not responding when sending email. 4 44
Automatic sort formula 8 53
Switch 5 17
ProperCase in Excel (Sheet) 3 13
Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
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 view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

809 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