17c7e A Debug Challenge...
Sign Up |  Live StatsLive Stats    Articles 37,318| Comments 177,162| Members 19,406, Newest GURBACHANSINGH| Online 481
Home Contact
 (Forgotten?): 
    Sikhism
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




A Debug Challenge...

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 115 USD (23%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
Norway's Challenge Soul_jyot People & Opinion 1 28-Jul-2011 17:09 PM
A challenge Tom Information Technology 5 28-Jul-2006 08:13 AM
RE: debug error on ".MoveFirst" statement Ken Higgins Information Technology 0 28-Jul-2006 08:01 AM
RE: Visual C++ Debug Library error and Report creation error BJC Information Technology 0 04-Nov-2005 15:20 PM
RE: Visual C++ Debug Library error BJC Information Technology 0 04-Nov-2005 15:19 PM


Tags
debug, challenge
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:00 AM
Sharkbyte's Avatar Sharkbyte
Guest
 
Posts: n/a
   
   
A Debug Challenge...

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
Okay. This one has got me. Maybe someone, here, can offer another
suggestion...

Here's the code:

Dim Visit1 as String
Dim Visit2 as String

Visit1 = me.txtVisitDescription
Visit2 = Replace(Visit1, "'", "''")
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/9232-a-debug-challenge.html

DoCmd.RunSQL ("update tblsitevisits set visitdesc = '" & Visit2 & "' where
servicecall = txtservicecall and sitevisitnumber = txtlastsitevisit;")


The result is that the Update does not take.

I have stepped through, with warnings...run debug...and substituted values.
No warnings; empty debug window; and any configuration of substituted values
works.

I have even found that, after the first time stepping through, with
substituted values in a series of 6 SQL statements, each SQL statement works,
and the offending SQL will begin to work. Run without stepping through the
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=9232
statements, or remove the substituted value statements, and the original SQL
again doesn't populate the field.

Anyone want to take a shot at this?

Thanks.

Sharkbyte


Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Jul-2006, 08:00 AM
Douglas J Steele's Avatar Douglas J Steele
Guest
 
Posts: n/a
   
   
Re: A Debug Challenge...

The problem is that the variables txtservicecall and txtlastsitevisit are
inside the quotes, so Access sees the text, not the value contained in the
variables.

DoCmd.RunSQL "update tblsitevisits set visitdesc = '" & Visit2 & _
"' where servicecall = " & txtservicecall & " and " & _
"sitevisitnumber = " & txtlastsitevisit

That assumes that servicecall and sitevistnumber are both numeric fields. If
they're text, you'll need quotes:

DoCmd.RunSQL "update tblsitevisits set visitdesc = '" & Visit2 & _
"' where servicecall = " & Chr$(34) & txtservicecall & Chr$(34) & _
" and sitevisitnumber = " & Chr$(34) & txtlastsitevisit & Chr$(34)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Sharkbyte" wrote in message
news:F8A4D6EB-0264-4F07-9318-6037EF84E0D4@microsoft.com...
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=9232
> Okay. This one has got me. Maybe someone, here, can offer another
> suggestion...
>
> Here's the code:
>
> Dim Visit1 as String
> Dim Visit2 as String
>
> Visit1 = me.txtVisitDescription
> Visit2 = Replace(Visit1, "'", "''")
>
> DoCmd.RunSQL ("update tblsitevisits set visitdesc = '" & Visit2 & "' where
> servicecall = txtservicecall and sitevisitnumber = txtlastsitevisit;")
>
>
> The result is that the Update does not take.
>
> I have stepped through, with warnings...run debug...and substituted

values.
> No warnings; empty debug window; and any configuration of substituted

values
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=9232
> works.
>
> I have even found that, after the first time stepping through, with
> substituted values in a series of 6 SQL statements, each SQL statement

works,
> and the offending SQL will begin to work. Run without stepping through

the
> statements, or remove the substituted value statements, and the original

SQL
> again doesn't populate the field.
>
> Anyone want to take a shot at this?
>
> Thanks.
>
> Sharkbyte



Reply With Quote
  #3 (permalink)  
Old 28-Jul-2006, 08:00 AM
Tony Toews's Avatar Tony Toews
Guest
 
Posts: n/a
   
   
Re: A Debug Challenge...

Sharkbyte wrote:

>DoCmd.RunSQL ("update tblsitevisits set visitdesc = '" & Visit2 & "' where
>servicecall = txtservicecall and sitevisitnumber = txtlastsitevisit;")
>The result is that the Update does not take.
>
>I have stepped through, with warnings...run debug...and substituted values.
>No warnings; empty debug window; and any configuration of substituted values
>works.


I prefer, if DAO, to use Currentdb.Execute strSQL,dbfailonerror
command instead of docmd.runsql. For ADO use
CurrentProject.Connection.Execute strCommand, lngRecordsAffected,
adCmdText

If you're going to use docmd.setwarnings make very sure you put the
True statement in any error handling code as well. Otherwise weird
things may happen later on especially while you are working on the
app. For example you will no longer get the "Do you wish to save your
changes" message if you close an object. This may mean that unwanted
changes, deletions or additions will be saved to your MDB.

Also performance can be significantly different between the two
methods. One posting stated currentdb.execute took two seconds while
docmd.runsql took eight seconds. As always YMMV.

Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=9232
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=9232
Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Reply With Quote
  #4 (permalink)  
Old 28-Jul-2006, 08:00 AM
Sharkbyte's Avatar Sharkbyte
Guest
 
Posts: n/a
   
   
Re: A Debug Challenge...

Doug:

Actually, txtServiceCall and txtLastSiteVisit reference TextBox controls, on
the form. In this case, txtServiceCall is blank or "variant" and
txtLastSiteVisit is GeneralNumber.

Thank you for your suggestions.

Sharkbyte



"Douglas J Steele" wrote:

> The problem is that the variables txtservicecall and txtlastsitevisit are
> inside the quotes, so Access sees the text, not the value contained in the
> variables.
>
> DoCmd.RunSQL "update tblsitevisits set visitdesc = '" & Visit2 & _
> "' where servicecall = " & txtservicecall & " and " & _
> "sitevisitnumber = " & txtlastsitevisit
>
> That assumes that servicecall and sitevistnumber are both numeric fields. If
> they're text, you'll need quotes:
>
> DoCmd.RunSQL "update tblsitevisits set visitdesc = '" & Visit2 & _
> "' where servicecall = " & Chr$(34) & txtservicecall & Chr$(34) & _
> " and sitevisitnumber = " & Chr$(34) & txtlastsitevisit & Chr$(34)
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Sharkbyte" wrote in message
> news:F8A4D6EB-0264-4F07-9318-6037EF84E0D4@microsoft.com...
> > Okay. This one has got me. Maybe someone, here, can offer another
> > suggestion...
> >
> > Here's the code:
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=9232
> >
> > Dim Visit1 as String
> > Dim Visit2 as String
> >
> > Visit1 = me.txtVisitDescription
> > Visit2 = Replace(Visit1, "'", "''")
> >
> > DoCmd.RunSQL ("update tblsitevisits set visitdesc = '" & Visit2 & "' where
> > servicecall = txtservicecall and sitevisitnumber = txtlastsitevisit;")
> >
> >
> > The result is that the Update does not take.
> >
> > I have stepped through, with warnings...run debug...and substituted

> values.
> > No warnings; empty debug window; and any configuration of substituted

Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=9232
> values
> > works.
> >
> > I have even found that, after the first time stepping through, with
> > substituted values in a series of 6 SQL statements, each SQL statement

> works,
> > and the offending SQL will begin to work. Run without stepping through

> the
> > statements, or remove the substituted value statements, and the original

> SQL
> > again doesn't populate the field.
> >
> > Anyone want to take a shot at this?
> >
> > Thanks.
> >
> > Sharkbyte

>
>
>

Reply With Quote
  #5 (permalink)  
Old 28-Jul-2006, 08:00 AM
Sharkbyte's Avatar Sharkbyte
Guest
 
Posts: n/a
   
   
Re: A Debug Challenge...

  Donate Today!  
Okay. Stupid question time...

I simply open the code window, and write. I have never paid much attention
to DAO or ADO. (Not that I don't intend on expanding my Access knowledge, at
a later time.)

How can I tell which I am working with? Is it ADO, by default? Access2003,
is what I use.

Thanks.

Sharkbyte




"Tony Toews" wrote:

> Sharkbyte wrote:
>
> >DoCmd.RunSQL ("update tblsitevisits set visitdesc = '" & Visit2 & "' where
> >servicecall = txtservicecall and sitevisitnumber = txtlastsitevisit;")
> >The result is that the Update does not take.
> >
> >I have stepped through, with warnings...run debug...and substituted values.
> >No warnings; empty debug window; and any configuration of substituted values
> >works.

>
> I prefer, if DAO, to use Currentdb.Execute strSQL,dbfailonerror
> command instead of docmd.runsql. For ADO use
> CurrentProject.Connection.Execute strCommand, lngRecordsAffected,
> adCmdText
>
> If you're going to use docmd.setwarnings make very sure you put the
> True statement in any error handling code as well. Otherwise weird
> things may happen later on especially while you are working on the
> app. For example you will no longer get the "Do you wish to save your
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=9232
> changes" message if you close an object. This may mean that unwanted
> changes, deletions or additions will be saved to your MDB.
>
> Also performance can be significantly different between the two
> methods. One posting stated currentdb.execute took two seconds while
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=9232
> docmd.runsql took eight seconds. As always YMMV.
>
> Tony
> --
> Tony Toews, Microsoft Access MVP
> Please respond only in the newsgroups so that others can
> read the entire thread of messages.
> Microsoft Access Links, Hints, Tips & Accounting Systems at
> http://www.granite.ab.ca/accsmstr.htm
>

Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
30 Day Amrit Vel 'a'...
Today 21:09 PM
43 Replies, 471 Views
How Religions Change...
Today 19:33 PM
0 Replies, 28 Views
What Do You Think of...
Today 19:11 PM
38 Replies, 672 Views
Losing My Religion: Why...
Today 15:33 PM
4 Replies, 132 Views
How does Sikhi help you...
Today 14:28 PM
18 Replies, 776 Views
Do you believe in...
Today 12:00 PM
184 Replies, 3,876 Views
Thought of the Moment!
Today 10:07 AM
109 Replies, 5,133 Views
Amrit
Today 09:17 AM
5 Replies, 361 Views
What I believe Hukam to...
Today 03:15 AM
13 Replies, 170 Views
Should SPN Keep the...
Today 02:02 AM
19 Replies, 602 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 01:46 AM
304 Replies, 7,491 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Today 01:18 AM
173 Replies, 4,404 Views
Student Compares Toilet...
Today 01:05 AM
1 Replies, 92 Views
Map shows world's 'most...
Yesterday 18:58 PM
16 Replies, 290 Views
BHOOTS (Ghosts) and...
Yesterday 13:08 PM
102 Replies, 13,895 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 21:23 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.46636 seconds with 32 queries
0