Escaping special characters when entering values in DataSheet view (1 Viewer)

gkl

Registered User.
Local time
Today, 10:03
Joined
Dec 7, 2013
Messages
22
Dear All,

This might sound as an odd question, but I am interested into whether it is possible or not. Let's say I have a table with a text field and Required is set to Yes and Allow Zero Length Strings to No.

I want to input a value for this field which is "" (two double quotes literally). If you try to do that, Access thinks that you are trying to enter a zero-length string and the entry is blocked so I guess I have to escape them - coming from a programming background I tried \ but this resulted in the value \"\" going in and [] as I read on a webpage but this resulted in ["]["] in going in.

So the question is: if I want a value of "" to be the value and not the empty string how do I tell Access this is the case?

Regards,
George
 

jdraw

Super Moderator
Staff member
Local time
Today, 06:03
Joined
Jan 23, 2006
Messages
15,364
You may find this link of interest.

It's a little backwards from your needs, but does talk about Required and Zero Length Strings.


OOOps, just realized you initiated that thread ?????
 

spikepl

Eledittingent Beliped
Local time
Today, 11:03
Joined
Nov 3, 2010
Messages
6,144
Try "" for each ". So """" in total. Meaning, in VBA.

In typing in plain bound textbox "" should do.
 

jdraw

Super Moderator
Staff member
Local time
Today, 06:03
Joined
Jan 23, 2006
Messages
15,364
I agree with spike.

I used "" (2 double quotes) in data sheet view.
This shows nothing in the field but does show a length of 0.
It does not get selected when using Is Null.


Good stuff spike.
 

gkl

Registered User.
Local time
Today, 10:03
Joined
Dec 7, 2013
Messages
22
Try "" for each ". So """" in total. Meaning, in VBA.

In typing in plain bound textbox "" should do.

Unfortunately it doesn't work. To be more specific, I am in Access 2013 in Table DataSheet View for a field that has Required set to Yes and Allow Zero Length Strings to No and I am trying to insert the string literal "" as the value.

If I type """" (four double-quotes) then the value of the field is four double quotes and not two as I wanted.

Regards,
George
 

jdraw

Super Moderator
Staff member
Local time
Today, 06:03
Joined
Jan 23, 2006
Messages
15,364
What happens with 2 double quotes?


you're saying Required=Yes and zls = N0 --so 2 double quotes shouldn't be allowed.
 

gkl

Registered User.
Local time
Today, 10:03
Joined
Dec 7, 2013
Messages
22
What happens with 2 double quotes?


you're saying Required=Yes and zls = N0 --so 2 double quotes shouldn't be allowed.

If you take into account the special meaning of "", this would indicate a zero-length string which is not allowed based on zls=NO. So I want to waive the special meaning by telling Access that the value I want to put is not a zls but it is the string with value "".
 

jdraw

Super Moderator
Staff member
Local time
Today, 06:03
Joined
Jan 23, 2006
Messages
15,364
What would be the length of your "" string?
If 0, it will not be acceptable when ZLS =NO.

Not sure what else to say.
 

Pyro

Too busy to comment
Local time
Today, 21:03
Joined
Apr 2, 2009
Messages
126
If it at all helps, you can insert "" as a literal through VBA by using 6 double quotes:

Code:
me!<myfield>=""""""
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:03
Joined
May 7, 2009
Messages
19,175
another flaw in access.
 

gkl

Registered User.
Local time
Today, 10:03
Joined
Dec 7, 2013
Messages
22
So are we all saying, if my understanding is correct, that if allow zero-length strings is set to No then Access is not going to accept "" as a string literal because it will always translate it to a zls and there is no way to block this behavior?
 

Users who are viewing this thread

Top Bottom