Remove Quotation marks entered by users into forms (1 Viewer)

InstructionWhich7142

Registered User.
Local time
Today, 11:58
Joined
Feb 24, 2010
Messages
199
I'd like to strip quotation marks " from user inputs in a form control, this seems to be hard to do and harder to google

Issue is caused mostly because "Copy as Path" in Windows puts leading and trailing quotation marks, I thought it'd be fairly trivial to remove these in BeforeUpdate or something but it seems to be difficult!

Where am I going wrong?
 

Micron

AWF VIP
Local time
Today, 07:58
Joined
Oct 20, 2018
Messages
3,476
Me.YourFieldName = Replace(Me.YourFieldNamd,""","")
Possibly run this in the form BeforeUpdate event. If there are several involved, a function might make more sense. If single quotes or smart quotes are involved, you'll need something a bit more complicated.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:58
Joined
May 7, 2009
Messages
19,175
you can also do it on the AfterUpdate event of the textbox.
 

InstructionWhich7142

Registered User.
Local time
Today, 11:58
Joined
Feb 24, 2010
Messages
199
Thanks, AfterUpdate was the bit I was missing, this worked:

Me.Text64 = Replace(Me.Text64, Chr(34), "")

for some reason:
Me.Text64 = Replace(Me.Text64, """, "")
this goes red like it doesn't like it?

And anything in BeforeUpdate gives me

Run-time error '-2147352567 (80020009)':
The Macro or function set to the beforeupdate property for this field is preventing MS Access from Saving the data in the field
 

Micron

AWF VIP
Local time
Today, 07:58
Joined
Oct 20, 2018
Messages
3,476
Sorry, I should have tested nesting quotations. Now that I think of it, I don't think any sort of nesting would work.
 

Users who are viewing this thread

Top Bottom