279d Sikh Philosophy Network - View Single Post - A Debug Challenge...
View Single Post
  #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...
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/9232-a-debug-challenge.html
> > 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
> > 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

Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=9232
> 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
 
Page generated in 0.21641 seconds with 25 queries
0