Restricting certain character types and saving a record

  • Thread starter Thread starter Alex via AccessMonster.com
  • Start date Start date
A

Alex via AccessMonster.com

Greetings! I need help on saving a record 1st of all. I need a code that
would work without promting the user to save, i.e. "Save: Yes/No". I want the
user to click the button so the record be saved without any confirmations.

The other question is if I can restrict certain character types in a "text"
field like, i.e. (@,#,$, ect.)

Thank you for any help
 
To force the record to save, use any of the following in the Click of your
command button:
Me.Dirty = False
RunCommand acCmdSaveRecord
Me.Refresh
Note that the user will still get a message if there is a reason why the
record cannot be saved. Also, the record could be saved by means other than
your button, such as by moving to another record, applying a filter, or
closing the form.

To block certain characters in a field, open the table in design view.
Select the field.
In the lower pane, set the Validation Rule to:
Not Like "*[@,#,$]*"
 
To avoid the Save: Yes/No message:
DoCmd.SetWarnings False

To limit the characters that are allowed in your text box, see Input Mask
property in Access Help.
 
Back
Top