PC Review


Reply
Thread Tools Rate Thread

DoCmd RunSQL issue

 
 
Gary
Guest
Posts: n/a
 
      11th Sep 2008
I created a SQL that will work sometimes and other times it doesn't. When
it doesn't work, I copy and paste the SQL string from the immediate window
into a query in sql view. It normally doesn't work unless I remove some the
carrage returns and then I can select the normal query view and run the
query. The query will run then.

I don't know what is ADP, but I am using Access 2000 and vba code. The
command I use is:

DoCmd RunSQL SQLS

where SQLS is a String. I check the length of the String and its about
3030 characters in length.

Can someone please help.


Thank You,

Gary
 
Reply With Quote
 
 
 
 
Tony Toews [MVP]
Guest
Posts: n/a
 
      11th Sep 2008
Gary <(E-Mail Removed)> wrote:

>DoCmd RunSQL SQLS


For starters use currentdb.execute SQLS, dbfailonerror.

That should give you error messages to help you figure out the
problem.

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
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
Reply With Quote
 
David W. Fenton
Guest
Posts: n/a
 
      14th Sep 2008
"Tony Toews [MVP]" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> Gary <(E-Mail Removed)> wrote:
>
>>DoCmd RunSQL SQLS

>
> For starters use currentdb.execute SQLS, dbfailonerror.
>
> That should give you error messages to help you figure out the
> problem.


If you use dbFailOnError, you really do need an error handler, or
the user is going to get a generic error message with the
Debug/Cancel/End choices, and that's not a good thing.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
 
Reply With Quote
 
Tony Toews [MVP]
Guest
Posts: n/a
 
      14th Sep 2008
"David W. Fenton" <(E-Mail Removed)> wrote:

>If you use dbFailOnError, you really do need an error handler, or
>the user is going to get a generic error message with the
>Debug/Cancel/End choices, and that's not a good thing.


Presumably if the poster is working in VBA they know about adding
error handling in each routine. I saw no need to explicitly mention
such.

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
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
Reply With Quote
 
David W. Fenton
Guest
Posts: n/a
 
      16th Sep 2008
"Tony Toews [MVP]" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> "David W. Fenton" <(E-Mail Removed)> wrote:
>
>>If you use dbFailOnError, you really do need an error handler, or
>>the user is going to get a generic error message with the
>>Debug/Cancel/End choices, and that's not a good thing.

>
> Presumably if the poster is working in VBA they know about adding
> error handling in each routine. I saw no need to explicitly
> mention such.


Well, I was writing Execute statements with dbFailOnError on the
recommendation of folks in the newsgroups for years before I
realized I needed an error handler. Obviously, I didn't encounter
any actual errors between the time I started using it and the point
at which I discovered I needed it.

In other words, don't assume that your readers know, because even
people like me, who have much more experience than your
garden-variety newbie can miss the obvious.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What Do You Use Instead of DoCmd.OpenQuery or DoCmd.RunSQL Mr. JYC Microsoft Access VBA Modules 2 30th Sep 2008 07:31 PM
doCmd.RunSQL Help JB Microsoft Access Form Coding 1 22nd Oct 2003 09:11 PM
DoCmd.RunSQL Jim Microsoft Access 1 10th Sep 2003 04:24 PM
Need help using Docmd.RunSql Dustin Microsoft Access Form Coding 2 16th Aug 2003 11:12 PM
DoCmd.RunSQL Chris Microsoft Access VBA Modules 0 15th Aug 2003 10:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:52 PM.