Can an "Update" Query insert quotation marks around text?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. My table contains a single text field. That's all! For instance, one
of the records might be: california state university Another record
might be: arizon astate

NEEDED: I need to ad QUOTATION MARKS characters around each record, so they
now will have this format: "california state university" or "arizona
state"

Can someone tell me how to create an UPDATE QUERY to do this?

Thanks

Rodney Dangerfield

(I don't get no respect. No respect at all! Hey, when I was born I was
ugly. Real ugly. How ugly was I? When I was born, my mother slapped the
doctor! I'll tell you, I don't get no respect.)
 
It's a bit unusual to delimit a text value in a text field with "
characters. Typically, that is done when you export the value to a text file
or other file so that the resulting file will know that the output is a text
string. Is that why you want to do this? If yes, you can do this during the
export process by exporting a query that uses a calculated field in place of
the original field:
OutField: Chr(34) & [FieldName] & Chr(34)

To do what you ask, yes, an update query can do this:

UPDATE TableName
SET FieldName = Chr(34) & [FieldName] & Chr(34);
 
Hi Ken
Thanks for the reply.

No, I don't want to ad the quotations during any data export.

Rather, I want the actual quotation marks to be stored IN the record. (I
want to store the text WITH the actual quote marks, i.e. "arizona state
college").

Do you know how to do this?

Jim

Ken Snell said:
It's a bit unusual to delimit a text value in a text field with "
characters. Typically, that is done when you export the value to a text file
or other file so that the resulting file will know that the output is a text
string. Is that why you want to do this? If yes, you can do this during the
export process by exporting a query that uses a calculated field in place of
the original field:
OutField: Chr(34) & [FieldName] & Chr(34)

To do what you ask, yes, an update query can do this:

UPDATE TableName
SET FieldName = Chr(34) & [FieldName] & Chr(34);
--

Ken Snell
<MS ACCESS MVP>

Rodney Dangerfield said:
Hi. My table contains a single text field. That's all! For instance, one
of the records might be: california state university Another record
might be: arizon astate

NEEDED: I need to ad QUOTATION MARKS characters around each record, so they
now will have this format: "california state university" or "arizona
state"

Can someone tell me how to create an UPDATE QUERY to do this?

Thanks

Rodney Dangerfield

(I don't get no respect. No respect at all! Hey, when I was born I was
ugly. Real ugly. How ugly was I? When I was born, my mother slapped the
doctor! I'll tell you, I don't get no respect.)
 
That was the second part of my reply. I posted an example of an update query
that would do this.

--

Ken Snell
<MS ACCESS MVP>

Rodney Dangerfield said:
Hi Ken
Thanks for the reply.

No, I don't want to ad the quotations during any data export.

Rather, I want the actual quotation marks to be stored IN the record. (I
want to store the text WITH the actual quote marks, i.e. "arizona state
college").

Do you know how to do this?

Jim

Ken Snell said:
It's a bit unusual to delimit a text value in a text field with "
characters. Typically, that is done when you export the value to a text file
or other file so that the resulting file will know that the output is a text
string. Is that why you want to do this? If yes, you can do this during the
export process by exporting a query that uses a calculated field in place of
the original field:
OutField: Chr(34) & [FieldName] & Chr(34)

To do what you ask, yes, an update query can do this:

UPDATE TableName
SET FieldName = Chr(34) & [FieldName] & Chr(34);
--

Ken Snell
<MS ACCESS MVP>

message news:[email protected]...
Hi. My table contains a single text field. That's all! For
instance,
one
of the records might be: california state university Another record
might be: arizon astate

NEEDED: I need to ad QUOTATION MARKS characters around each record,
so
they
now will have this format: "california state university" or "arizona
state"

Can someone tell me how to create an UPDATE QUERY to do this?

Thanks

Rodney Dangerfield

(I don't get no respect. No respect at all! Hey, when I was born I was
ugly. Real ugly. How ugly was I? When I was born, my mother slapped the
doctor! I'll tell you, I don't get no respect.)
 
Sorry I missed that, Ken. Ok. Yes, I tried this and you are right . . . my
records are now updated to include " " marks around the text. That's perfect!

But now I've got another problem, I think. Here's what's happening . . .

(a) I open the table
(b) I then drag my cursor over the three rows I want to copy (which now all
DO have the "quotes" around them)
(c) I then "paste" them into any other word processing document (MS-Word,
Notepad, or etc)
(d) Here's what get's pasted . . .

"""arizona state"""
"""california state university"""
"""michigan college"""

THE PROBLEM: No matter which word processing software I use to test the
pasting process (MS-Word, Notepad) . . . I'm getting 2 (!) extra sets of
quotations around each line. In other words, although INside Access (when
viewed in table view) the records look like this:

"arizona state"
"california state university"
"michigan college"

BUT . . . . as soon as I "copy-and-paste" that information into any other
software, some HIDDEN (extra?) sets of quote marks appear. Geeesh. How to I
avoid this? Any idea? Thanks
Ken Snell said:
That was the second part of my reply. I posted an example of an update query
that would do this.

--

Ken Snell
<MS ACCESS MVP>

Rodney Dangerfield said:
Hi Ken
Thanks for the reply.

No, I don't want to ad the quotations during any data export.

Rather, I want the actual quotation marks to be stored IN the record. (I
want to store the text WITH the actual quote marks, i.e. "arizona state
college").

Do you know how to do this?

Jim

Ken Snell said:
It's a bit unusual to delimit a text value in a text field with "
characters. Typically, that is done when you export the value to a text file
or other file so that the resulting file will know that the output is a text
string. Is that why you want to do this? If yes, you can do this during the
export process by exporting a query that uses a calculated field in place of
the original field:
OutField: Chr(34) & [FieldName] & Chr(34)

To do what you ask, yes, an update query can do this:

UPDATE TableName
SET FieldName = Chr(34) & [FieldName] & Chr(34);
--

Ken Snell
<MS ACCESS MVP>

message Hi. My table contains a single text field. That's all! For instance,
one
of the records might be: california state university Another record
might be: arizon astate

NEEDED: I need to ad QUOTATION MARKS characters around each record, so
they
now will have this format: "california state university" or "arizona
state"

Can someone tell me how to create an UPDATE QUERY to do this?

Thanks

Rodney Dangerfield

(I don't get no respect. No respect at all! Hey, when I was born I was
ugly. Real ugly. How ugly was I? When I was born, my mother slapped the
doctor! I'll tell you, I don't get no respect.)
 
What's happening is that the doubling of the quotes (resulting in triple
quotes) is because the software is reacting to the presence of your quotes.
In Microsoft products, when a " character is embedded in a text string, and
that text string is delimited by " characters within the software, the
software doubles the " character because that tells the software that the "
is not the beginning or end of a text string, but a literal " character.

Thus, you see """ at the beginning of the string, which correctly
intrepreted is this: the first " marks the beginning of the text string,
and the next two " characters ("") together are meant as a single " (the "
that you have in your ACCESS value) when the string is printed or displayed.
Similarly, the three trailing " characters have a similar interpretation:
the first two ("") are the one " that you had in your text string in ACCESS,
and the last " character marks the end of the text string.

As I noted, it's unusual to need to delimit a text string with " characters
within an ACCESS field. You're seeing one result of why it's not typically
done.
--

Ken Snell
<MS ACCESS MVP>



Rodney Dangerfield said:
Sorry I missed that, Ken. Ok. Yes, I tried this and you are right . . . my
records are now updated to include " " marks around the text. That's perfect!

But now I've got another problem, I think. Here's what's happening . . .

(a) I open the table
(b) I then drag my cursor over the three rows I want to copy (which now all
DO have the "quotes" around them)
(c) I then "paste" them into any other word processing document (MS-Word,
Notepad, or etc)
(d) Here's what get's pasted . . .

"""arizona state"""
"""california state university"""
"""michigan college"""

THE PROBLEM: No matter which word processing software I use to test the
pasting process (MS-Word, Notepad) . . . I'm getting 2 (!) extra sets of
quotations around each line. In other words, although INside Access (when
viewed in table view) the records look like this:

"arizona state"
"california state university"
"michigan college"

BUT . . . . as soon as I "copy-and-paste" that information into any other
software, some HIDDEN (extra?) sets of quote marks appear. Geeesh. How to I
avoid this? Any idea? Thanks
Ken Snell said:
That was the second part of my reply. I posted an example of an update query
that would do this.

--

Ken Snell
<MS ACCESS MVP>

message news:[email protected]...
Hi Ken
Thanks for the reply.

No, I don't want to ad the quotations during any data export.

Rather, I want the actual quotation marks to be stored IN the record. (I
want to store the text WITH the actual quote marks, i.e. "arizona state
college").

Do you know how to do this?

Jim

:

It's a bit unusual to delimit a text value in a text field with "
characters. Typically, that is done when you export the value to a
text
file
or other file so that the resulting file will know that the output
is a
text
string. Is that why you want to do this? If yes, you can do this
during
the
export process by exporting a query that uses a calculated field in place of
the original field:
OutField: Chr(34) & [FieldName] & Chr(34)

To do what you ask, yes, an update query can do this:

UPDATE TableName
SET FieldName = Chr(34) & [FieldName] & Chr(34);
--

Ken Snell
<MS ACCESS MVP>

"Rodney Dangerfield" <[email protected]>
wrote
in
message Hi. My table contains a single text field. That's all! For instance,
one
of the records might be: california state university Another record
might be: arizon astate

NEEDED: I need to ad QUOTATION MARKS characters around each
record,
so
they
now will have this format: "california state university" or "arizona
state"

Can someone tell me how to create an UPDATE QUERY to do this?

Thanks

Rodney Dangerfield

(I don't get no respect. No respect at all! Hey, when I was born
I
was
ugly. Real ugly. How ugly was I? When I was born, my mother
slapped
the
doctor! I'll tell you, I don't get no respect.)
 
Ok, I see now, Ken

I'm sure you're right.

Well, you've given me the basic solution . . . and I'll probably try to make
a macro or something like that to remove the extra quotes after exporting the
records.

Once again, THANKS for your help! I am grateful.

Bye

Jim (er, Rodney Dangerfield) -- "I don't get no respect!"

Ken Snell said:
What's happening is that the doubling of the quotes (resulting in triple
quotes) is because the software is reacting to the presence of your quotes.
In Microsoft products, when a " character is embedded in a text string, and
that text string is delimited by " characters within the software, the
software doubles the " character because that tells the software that the "
is not the beginning or end of a text string, but a literal " character.

Thus, you see """ at the beginning of the string, which correctly
intrepreted is this: the first " marks the beginning of the text string,
and the next two " characters ("") together are meant as a single " (the "
that you have in your ACCESS value) when the string is printed or displayed.
Similarly, the three trailing " characters have a similar interpretation:
the first two ("") are the one " that you had in your text string in ACCESS,
and the last " character marks the end of the text string.

As I noted, it's unusual to need to delimit a text string with " characters
within an ACCESS field. You're seeing one result of why it's not typically
done.
--

Ken Snell
<MS ACCESS MVP>



Rodney Dangerfield said:
Sorry I missed that, Ken. Ok. Yes, I tried this and you are right . . . my
records are now updated to include " " marks around the text. That's perfect!

But now I've got another problem, I think. Here's what's happening . . .

(a) I open the table
(b) I then drag my cursor over the three rows I want to copy (which now all
DO have the "quotes" around them)
(c) I then "paste" them into any other word processing document (MS-Word,
Notepad, or etc)
(d) Here's what get's pasted . . .

"""arizona state"""
"""california state university"""
"""michigan college"""

THE PROBLEM: No matter which word processing software I use to test the
pasting process (MS-Word, Notepad) . . . I'm getting 2 (!) extra sets of
quotations around each line. In other words, although INside Access (when
viewed in table view) the records look like this:

"arizona state"
"california state university"
"michigan college"

BUT . . . . as soon as I "copy-and-paste" that information into any other
software, some HIDDEN (extra?) sets of quote marks appear. Geeesh. How to I
avoid this? Any idea? Thanks
Ken Snell said:
That was the second part of my reply. I posted an example of an update query
that would do this.

--

Ken Snell
<MS ACCESS MVP>

message Hi Ken
Thanks for the reply.

No, I don't want to ad the quotations during any data export.

Rather, I want the actual quotation marks to be stored IN the record. (I
want to store the text WITH the actual quote marks, i.e. "arizona state
college").

Do you know how to do this?

Jim

:

It's a bit unusual to delimit a text value in a text field with "
characters. Typically, that is done when you export the value to a text
file
or other file so that the resulting file will know that the output is a
text
string. Is that why you want to do this? If yes, you can do this during
the
export process by exporting a query that uses a calculated field in
place of
the original field:
OutField: Chr(34) & [FieldName] & Chr(34)

To do what you ask, yes, an update query can do this:

UPDATE TableName
SET FieldName = Chr(34) & [FieldName] & Chr(34);
--

Ken Snell
<MS ACCESS MVP>

in
message Hi. My table contains a single text field. That's all! For
instance,
one
of the records might be: california state university Another
record
might be: arizon astate

NEEDED: I need to ad QUOTATION MARKS characters around each record,
so
they
now will have this format: "california state university" or
"arizona
state"

Can someone tell me how to create an UPDATE QUERY to do this?

Thanks

Rodney Dangerfield

(I don't get no respect. No respect at all! Hey, when I was born I
was
ugly. Real ugly. How ugly was I? When I was born, my mother slapped
the
doctor! I'll tell you, I don't get no respect.)
 
Back
Top