Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / December 2006

Tip: Looking for answers? Try searching our database.

syntax "" ' & #

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NetworkTrade - 29 Dec 2006 05:35 GMT
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
Signature

NTC

Ken Snell (MVP) - 29 Dec 2006 06:10 GMT
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
Signature


       Ken Snell
<MS ACCESS MVP>

> having a brain freeze
>
[quoted text clipped - 22 lines]
>
> merci
'69 Camaro - 29 Dec 2006 06:11 GMT
> 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
>
[quoted text clipped - 19 lines]
>
> merci
NetworkTrade - 30 Dec 2006 15:50 GMT
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,
Signature

NTC

> > having a brain freeze
>
[quoted text clipped - 35 lines]
> >
> > merci
Ken Snell (MVP) - 30 Dec 2006 16:14 GMT
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
Signature


       Ken Snell
<MS ACCESS MVP>

> well I appreciate the somewhat deserved tirade.  And appreciate the
> volunteerism.  Actually I'm generally a well behaved participant - the
[quoted text clipped - 65 lines]
>> >
>> > merci
'69 Camaro - 31 Dec 2006 00:27 GMT
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

> well I appreciate the somewhat deserved tirade.  And appreciate the
> volunteerism.  Actually I'm generally a well behaved participant - the other
[quoted text clipped - 56 lines]
>> >
>> > merci
'69 Camaro - 31 Dec 2006 00:40 GMT
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_search?q=group:*access*&scoring=d&num=100&hl=e
n&lr=lang_en&as_drrb=q&safe=off


Gunny

> Hi.
>
[quoted text clipped - 75 lines]
>>> >
>>> > merci
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.