Escaping special characters when entering values in DataSheet view

gkl

Registered User.
Local time
Today, 13:10
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
 
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 ?????
 
Try "" for each ". So """" in total. Meaning, in VBA.

In typing in plain bound textbox "" should do.
 
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.
 
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
 
What happens with 2 double quotes?


you're saying Required=Yes and zls = N0 --so 2 double quotes shouldn't be allowed.
 
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 "".
 
What would be the length of your "" string?
If 0, it will not be acceptable when ZLS =NO.

Not sure what else to say.
 
If it at all helps, you can insert "" as a literal through VBA by using 6 double quotes:

Code:
me!<myfield>=""""""
 
another flaw in access.
 
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

Back
Top Bottom