PC Review


Reply
Thread Tools Rate Thread

lack of errormessage

 
 
mi
Guest
Posts: n/a
 
      16th Aug 2011
I am running a SQLquestion in VB. This does not work and the
errormessage I get is poor:
"cannot execute a select query"

SQLstr = "SELECT * FROM tblMag1;"
CurrentDb.Execute SQLstr

I know it's possible to get moore information than that but I have
forgotten how.

Can anyone please help me.

Thanks in advance
/(E-Mail Removed)



 
Reply With Quote
 
 
 
 
Tony Toews
Guest
Posts: n/a
 
      18th Aug 2011
On Tue, 16 Aug 2011 07:52:47 -0700 (PDT), mi
<(E-Mail Removed)> wrote:

>I am running a SQLquestion in VB. This does not work and the
>errormessage I get is poor:
>"cannot execute a select query"
>
>SQLstr = "SELECT * FROM tblMag1;"
> CurrentDb.Execute SQLstr


add ", dbfailonerrors" to the currentdb line.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 
Reply With Quote
 
 
 
 
David-W-Fenton
Guest
Posts: n/a
 
      19th Aug 2011
Tony Toews <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> On Tue, 16 Aug 2011 07:52:47 -0700 (PDT), mi
><(E-Mail Removed)> wrote:
>
>>I am running a SQLquestion in VB. This does not work and the
>>errormessage I get is poor:
>>"cannot execute a select query"
>>
>>SQLstr = "SELECT * FROM tblMag1;"
>> CurrentDb.Execute SQLstr

>
> add ", dbfailonerrors" to the currentdb line.


SELECT statements cannot be .Executed.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
 
Reply With Quote
 
Tony Toews
Guest
Posts: n/a
 
      20th Aug 2011
On Fri, 19 Aug 2011 22:17:07 +0000 (UTC), "David-W-Fenton"
<(E-Mail Removed)> wrote:

>>>I am running a SQLquestion in VB. This does not work and the
>>>errormessage I get is poor:
>>>"cannot execute a select query"
>>>
>>>SQLstr = "SELECT * FROM tblMag1;"
>>> CurrentDb.Execute SQLstr

>>
>> add ", dbfailonerrors" to the currentdb line.

>
>SELECT statements cannot be .Executed.


Duhhhh. You're correct.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 
Reply With Quote
 
mi
Guest
Posts: n/a
 
      21st Aug 2011
On Aug 20, 12:17*am, "David-W-Fenton" <(E-Mail Removed)>
wrote:
> Tony Toews <(E-Mail Removed)> wrote innews:(E-Mail Removed):
>
> > On Tue, 16 Aug 2011 07:52:47 -0700 (PDT), mi
> ><(E-Mail Removed)> wrote:

>
> >>I am running a SQLquestion in *VB. This does not work and the
> >>errormessage I get is poor:
> >>"cannot execute a select query"

>
> >>SQLstr = "SELECT * FROM tblMag1;"
> >> * * CurrentDb.Execute SQLstr

>
> > add ", dbfailonerrors" to the currentdb line.

>
> SELECT statements cannot be .Executed.
>
> --
> David W. Fenton * * * * * * * * *http://www.dfenton.com/
> contact via website only * *http://www.dfenton.com/DFA/



I changed the selction to:
SQLstr = "SELECT [tbMag1].[datum],[tbMag1].[bild] FROM tblMag1 ; "
CurrentDb.Execute SQLstr,dbfailonerrors

The result is the same as before: 'cannot execute the query'.
Does dbfailonerrors needs a definition?

/Michelle
 
Reply With Quote
 
mi
Guest
Posts: n/a
 
      21st Aug 2011
On Aug 18, 3:27*am, Tony Toews <(E-Mail Removed)> wrote:
> On Tue, 16 Aug 2011 07:52:47 -0700 (PDT), mi
>
> <(E-Mail Removed)> wrote:
> >I am running a SQLquestion in *VB. This does not work and the
> >errormessage I get is poor:
> >"cannot execute a select query"

>
> >SQLstr = "SELECT * FROM tblMag1;"
> > * * CurrentDb.Execute SQLstr

>
> add ", dbfailonerrors" to the currentdb line.
>
> Tony
> --
> Tony Toews, Microsoft Access MVP
> Tony's Main MS Access pages -http://www.granite.ab.ca/accsmstr.htm
> Tony's Microsoft Access Blog -http://msmvps.com/blogs/access/
> For a convenient utility to keep your users FEs and other files
> * updated seehttp://www.autofeupdater.com/


I try to explanation a little better what I'm doing.

Public Sub importTmpTb()
On Error GoTo Err_importTmpTb

Dim bild As Integer
Dim magasin As String
Dim beskrivning As String

I have tried select

SQLstr = "SELECT [tbMag1].[datum],[tbMag1].[bild] FROM tblMag1
WHERE ] tbMag1].[bild] = 3 ; "

SQLstr = "SELECT [datum],[bild] FROM tblMag1 WHERE [bild] = 3; "

as well as two differen execute

CurrentDb.Execute SQLstr,dbfailonerrors
CurrentDb.Execute SQLstr


And nothing works.

Can please anyone give me some idea what I'm doing wrong.
Thanks in advance.

/Michelle
 
Reply With Quote
 
David-W-Fenton
Guest
Posts: n/a
 
      21st Aug 2011
mi <(E-Mail Removed)> wrote in
news:(E-Mail Removed)
:

> On Aug 20, 12:17*am, "David-W-Fenton"
> <(E-Mail Removed)> wrote:
>> Tony Toews <(E-Mail Removed)> wrote
>> innews:ljqo4792gd7lrdnj4rglr31b

> (E-Mail Removed):
>>
>> > On Tue, 16 Aug 2011 07:52:47 -0700 (PDT), mi
>> ><(E-Mail Removed)> wrote:

>>
>> >>I am running a SQLquestion in *VB. This does not work and the
>> >>errormessage I get is poor:
>> >>"cannot execute a select query"

>>
>> >>SQLstr = "SELECT * FROM tblMag1;"
>> >> * * CurrentDb.Execute SQLstr

>>
>> > add ", dbfailonerrors" to the currentdb line.

>>
>> SELECT statements cannot be .Executed.

>
> I changed the selction to:
> SQLstr = "SELECT [tbMag1].[datum],[tbMag1].[bild] FROM tblMag1 ;
> "
> CurrentDb.Execute SQLstr,dbfailonerrors
>
> The result is the same as before: 'cannot execute the query'.
> Does dbfailonerrors needs a definition?


Only DML statements (i.e., what are referred to in Access as "action
queries," i.e., queries that MODIFY data) can be EXECUTED.

What are you trying to do with your SELECT statement? Do you want to
open a recordset? Display the data to a user?

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
 
Reply With Quote
 
Tony Toews
Guest
Posts: n/a
 
      22nd Aug 2011
On Sun, 21 Aug 2011 06:16:42 -0700 (PDT), mi
<(E-Mail Removed)> wrote:

>Can please anyone give me some idea what I'm doing wrong.


As David points out, and I missed, is that you can't run a SELECT
query using an Execute statement because there is no action, such as
update, insert or delete to perform.

We need to know what you want to do with the query to help you
further. You likely want a recordset variable so you can loop
through the recordset and do something.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 
Reply With Quote
 
mi
Guest
Posts: n/a
 
      22nd Aug 2011
It makes me really glad that someone wants to help me.

I have excel-files that contain 4 columns which in the end shall
inserts in another table with 12 columns.

Iíve transformed the excel-files to tables.
So now I want to read the new tables and add them to the main table
but depending of the data in the 4 columns I will add different data
in the rest 8 columns.

That is why Iím trying to do select in the table.

Is that clear enough?

/Michelle
 
Reply With Quote
 
mi
Guest
Posts: n/a
 
      23rd Aug 2011
On Aug 22, 5:53*pm, mi <(E-Mail Removed)> wrote:
> It makes me really glad that someone wants to help me.
>
> I have excel-files that contain 4 columns which in the end shall
> inserts in another table with 12 columns.
>
> Iíve transformed the excel-files to tables.
> So now I want to read the new tables and add them to the main table
> but depending of the data in the 4 columns I will add different data
> in the rest 8 columns.
>
> That is why Iím trying to do select in the table.
>
> Is that clear enough?
>
> /Michelle


Noone go un idea how to solve this?

/Michelle
 
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
Re: errormessage and how to fix BEN T Windows XP Networking 1 20th Sep 2004 07:45 AM
Errormessage for the briefcase Roger Windows XP General 0 1st Sep 2004 08:47 AM
Please help vidboot errormessage =?Utf-8?B?d29ybTg=?= Windows XP Help 0 7th Mar 2004 01:01 AM
ipod errormessage follow =?Utf-8?B?aHJlYmVu?= Windows XP Help 0 3rd Jan 2004 12:51 AM
infinite errormessage bombardment Jens Windows XP Help 1 9th Dec 2003 03:43 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:50 AM.