syntax "" ' & #

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

Guest

having a brain freeze

Private Sub Command48_Click()

CurrentDb().Execute "UPDATE QBTerms SET [date] = 'Smile' WHERE record = 4;",
dbFailOnError

End Sub

works fine - puts the word Smile into the 4th record of the Date column in
the QBTerms table

Now my confusion begins if:

rather than hardcode the word smile, need to insert a value from txtBox1 of
Form and is text

think I've tried all combos of symbols and am pretzel brained....as long as
I'm asking the experts
b. ditto but is a number rather than text
c. ditto again but is a date

merci
 
CurrentDb().Execute "UPDATE QBTerms SET [date] = '" & txtBox1 & "' WHERE
record = 4;", dbFailOnError

If the string in txtBox1 might have a ' character in it, then use this:

CurrentDb().Execute "UPDATE QBTerms SET [date] = '" & Replace(txtBox1, "'",
"''", 1, -1, vbTextCompare) & "' WHERE record = 4;", dbFailOnError
 
having a brain freeze

This newsgroup is staffed by volunteers, not paid employees. It's considered
rude to ask for help, then abandon a thread and start a new one. If you aren't
getting help fast enough, then you are free to hire tech support. Please read
the following Web page to find out what you can expect and what is expected of
you when participating in the newsgroups:

http://www.mvps.org/access/netiquette.htm

Please pay particular attention to the section "Asking questions the right way"
which states "If you don't get an answer in 2 days, re-post after re-reading
your first post for clarity."

Gunny
 
well I appreciate the somewhat deserved tirade. And appreciate the
volunteerism. Actually I'm generally a well behaved participant - the other
night the site was not expanding any dialogs at all. I could see the title
but none would expand to the content....(so didn't see your advice reply
until now) but I could, at the time, create a New - so threw out this other
abbreviated repeat question.

The triple quote doesn't seem to be working though I know I've done it
before and I know it works. In fact KSnell's advice here I tried quickly
threw an error too. I think I may have something else going on and plan to
collate all advice & reference info and do a sanity check using other
machines' Access installs - - -but have been pulled away to another
application more pressing - so back to this soon....

not ungrateful,
--
NTC


'69 Camaro said:
having a brain freeze

This newsgroup is staffed by volunteers, not paid employees. It's considered
rude to ask for help, then abandon a thread and start a new one. If you aren't
getting help fast enough, then you are free to hire tech support. Please read
the following Web page to find out what you can expect and what is expected of
you when participating in the newsgroups:

http://www.mvps.org/access/netiquette.htm

Please pay particular attention to the section "Asking questions the right way"
which states "If you don't get an answer in 2 days, re-post after re-reading
your first post for clarity."

Gunny


NetworkTrade said:
having a brain freeze

Private Sub Command48_Click()

CurrentDb().Execute "UPDATE QBTerms SET [date] = 'Smile' WHERE record = 4;",
dbFailOnError

End Sub

works fine - puts the word Smile into the 4th record of the Date column in
the QBTerms table

Now my confusion begins if:

rather than hardcode the word smile, need to insert a value from txtBox1 of
Form and is text

think I've tried all combos of symbols and am pretzel brained....as long as
I'm asking the experts
b. ditto but is a number rather than text
c. ditto again but is a date

merci
 
It's not a triple quote -- it is a " character and then a ' character, or
vice versa, depending upon the location in the string. Here are "expanded"
view of the examples, with extraneous spaces put in for visible clarity (you
cannot have the spaces in the actual code steps, though):

CurrentDb().Execute "UPDATE QBTerms SET [date] = ' " & txtBox1 & " ' WHERE
record = 4;", dbFailOnError

If the string in txtBox1 might have a ' character in it, then use this:

CurrentDb().Execute "UPDATE QBTerms SET [date] = ' " & Replace(txtBox1, " '
",
" ' ' ", 1, -1, vbTextCompare) & " ' WHERE record = 4;", dbFailOnError
--

Ken Snell
<MS ACCESS MVP>

NetworkTrade said:
well I appreciate the somewhat deserved tirade. And appreciate the
volunteerism. Actually I'm generally a well behaved participant - the
other
night the site was not expanding any dialogs at all. I could see the
title
but none would expand to the content....(so didn't see your advice reply
until now) but I could, at the time, create a New - so threw out this
other
abbreviated repeat question.

The triple quote doesn't seem to be working though I know I've done it
before and I know it works. In fact KSnell's advice here I tried quickly
threw an error too. I think I may have something else going on and plan
to
collate all advice & reference info and do a sanity check using other
machines' Access installs - - -but have been pulled away to another
application more pressing - so back to this soon....

not ungrateful,
--
NTC


'69 Camaro said:
having a brain freeze

This newsgroup is staffed by volunteers, not paid employees. It's
considered
rude to ask for help, then abandon a thread and start a new one. If you
aren't
getting help fast enough, then you are free to hire tech support. Please
read
the following Web page to find out what you can expect and what is
expected of
you when participating in the newsgroups:

http://www.mvps.org/access/netiquette.htm

Please pay particular attention to the section "Asking questions the
right way"
which states "If you don't get an answer in 2 days, re-post after
re-reading
your first post for clarity."

Gunny


NetworkTrade said:
having a brain freeze

Private Sub Command48_Click()

CurrentDb().Execute "UPDATE QBTerms SET [date] = 'Smile' WHERE record =
4;",
dbFailOnError

End Sub

works fine - puts the word Smile into the 4th record of the Date column
in
the QBTerms table

Now my confusion begins if:

rather than hardcode the word smile, need to insert a value from
txtBox1 of
Form and is text

think I've tried all combos of symbols and am pretzel brained....as
long as
I'm asking the experts
b. ditto but is a number rather than text
c. ditto again but is a date

merci
 
Hi.

Thanks for the explanation. You're a victim of circumstances. I posted my
tirade after I saw you start a new thread on the same subject I was working on
with you, right after I deleted a very long message I had written to help
another poster when I discovered that she had multiposted and her other post had
already been answered by others. She hadn't bothered to come back and post a
reply to her unanswered question to say, "Never mind. I got my answer in the
other newsgroup."

Both of you got a message from me about netiquette. If the other poster hadn't
carelessly wasted my time, I wouldn't have been annoyed enough to write my
message to you.

Gunny


NetworkTrade said:
well I appreciate the somewhat deserved tirade. And appreciate the
volunteerism. Actually I'm generally a well behaved participant - the other
night the site was not expanding any dialogs at all. I could see the title
but none would expand to the content....(so didn't see your advice reply
until now) but I could, at the time, create a New - so threw out this other
abbreviated repeat question.

The triple quote doesn't seem to be working though I know I've done it
before and I know it works. In fact KSnell's advice here I tried quickly
threw an error too. I think I may have something else going on and plan to
collate all advice & reference info and do a sanity check using other
machines' Access installs - - -but have been pulled away to another
application more pressing - so back to this soon....

not ungrateful,
--
NTC


'69 Camaro said:
having a brain freeze

This newsgroup is staffed by volunteers, not paid employees. It's considered
rude to ask for help, then abandon a thread and start a new one. If you
aren't
getting help fast enough, then you are free to hire tech support. Please
read
the following Web page to find out what you can expect and what is expected
of
you when participating in the newsgroups:

http://www.mvps.org/access/netiquette.htm

Please pay particular attention to the section "Asking questions the right
way"
which states "If you don't get an answer in 2 days, re-post after re-reading
your first post for clarity."

Gunny


NetworkTrade said:
having a brain freeze

Private Sub Command48_Click()

CurrentDb().Execute "UPDATE QBTerms SET [date] = 'Smile' WHERE record =
4;",
dbFailOnError

End Sub

works fine - puts the word Smile into the 4th record of the Date column in
the QBTerms table

Now my confusion begins if:

rather than hardcode the word smile, need to insert a value from txtBox1 of
Form and is text

think I've tried all combos of symbols and am pretzel brained....as long as
I'm asking the experts
b. ditto but is a number rather than text
c. ditto again but is a date

merci
 
Hi.

And next time the Web site is acting up (the Web programmers have been updating
the site recently), go to Google Groups and search on your name as the author to
find your most recent threads, to see whether or not you have replies:

http://groups.google.com/advanced_s...d&num=100&hl=en&lr=lang_en&as_drrb=q&safe=off

Gunny


'69 Camaro said:
Hi.

Thanks for the explanation. You're a victim of circumstances. I posted my
tirade after I saw you start a new thread on the same subject I was working on
with you, right after I deleted a very long message I had written to help
another poster when I discovered that she had multiposted and her other post
had already been answered by others. She hadn't bothered to come back and
post a reply to her unanswered question to say, "Never mind. I got my answer
in the other newsgroup."

Both of you got a message from me about netiquette. If the other poster
hadn't carelessly wasted my time, I wouldn't have been annoyed enough to write
my message to you.

Gunny


NetworkTrade said:
well I appreciate the somewhat deserved tirade. And appreciate the
volunteerism. Actually I'm generally a well behaved participant - the other
night the site was not expanding any dialogs at all. I could see the title
but none would expand to the content....(so didn't see your advice reply
until now) but I could, at the time, create a New - so threw out this other
abbreviated repeat question.

The triple quote doesn't seem to be working though I know I've done it
before and I know it works. In fact KSnell's advice here I tried quickly
threw an error too. I think I may have something else going on and plan to
collate all advice & reference info and do a sanity check using other
machines' Access installs - - -but have been pulled away to another
application more pressing - so back to this soon....

not ungrateful,
--
NTC


'69 Camaro said:
having a brain freeze

This newsgroup is staffed by volunteers, not paid employees. It's
considered
rude to ask for help, then abandon a thread and start a new one. If you
aren't
getting help fast enough, then you are free to hire tech support. Please
read
the following Web page to find out what you can expect and what is expected
of
you when participating in the newsgroups:

http://www.mvps.org/access/netiquette.htm

Please pay particular attention to the section "Asking questions the right
way"
which states "If you don't get an answer in 2 days, re-post after re-reading
your first post for clarity."

Gunny


having a brain freeze

Private Sub Command48_Click()

CurrentDb().Execute "UPDATE QBTerms SET [date] = 'Smile' WHERE record =
4;",
dbFailOnError

End Sub

works fine - puts the word Smile into the 4th record of the Date column in
the QBTerms table

Now my confusion begins if:

rather than hardcode the word smile, need to insert a value from txtBox1
of
Form and is text

think I've tried all combos of symbols and am pretzel brained....as long
as
I'm asking the experts
b. ditto but is a number rather than text
c. ditto again but is a date

merci
 
Back
Top