Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No commas please, we're British.... 1

Status
Not open for further replies.

warren66

Technical User
Dec 9, 2003
10
GB
I am designing a database for a remote workers to enter data into, and since this data will eventually be exported into a csv file, I want to suppress the use of commas anywhere in a particular table.

Is there a way of prohibiting the entry of a comma in the text fields, or alternatively is there something that I can put in a macro which will do the equivalent of opening the table, and then Ctrl-H'ing the comma for a space?

There doesn't seem to be a facilty for entering and appropriate argument for the macro function Replace.

All suggestions gratefully received.
 
Just a thought, but you could run the records thru the Replace Function and use it to get rid of "," and replace it with a space. If I was doing it I would probably set up a query with a series of fields that sent the info out to the Replace function to return cleaned up data. The question will be whether you can use the Replace function directly in the Query or whether you will have to create a function in a module and use the Replace function inside that. I'm guessing it will be the second way. Then you can just export the query to your csv file.

Paul
 
You can set up the KeyPress event on a form, set the KeyPreview property to true to set the form level as a higher priority than the control level.
If written properly it would let you set any commas to null as the character was entered, which means that they won't be able to enter it directly from the keyboard or through the Alt key and numeric pad.

John
 
Thank you very much guys, for those suggestions. I have used a variation Zameer's suggestion, using a input mask of a's which permits the use of alphas, numerics and spaces, but nothing else.

This is ideal for addresses, when the user cannot enter a comma, or put a house name in inverted commas.

Once again, thanks for your kind interest, and may I wish you all a very happy and peaceful 2004.

Regards


warren66
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top