To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here

HOME News MS SQL Oracle DB2 Access MySQL PHP Scripts Books Links DBA Talk


Go Back   Database Journal Forums > Miscellaneous > Ask an Expert

Ask an Expert Ask our SQL experts the tough questions that have you stumped. Members are limited to one question a week, so ask your questions wisely!

Reply Post New Thread
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 05-17-2007, 08:43 AM
danish_ara danish_ara is offline
Registered User
 
Join Date: May 2007
Posts: 3
Multiple queries on MS Access

Hi,

I am going through some serious problem with ms access queries. I am trying to run multiple statements on ms access database in the "SQL View".

Moreover when I try to solve this problem through recordsets in ASP 3.0, I experience the same problem.

the error is thrown "characters found after the end of SQL statement"

I want to run 2 statements one after another on the same record set execution.

Example:

select * from temp; drop table temp;

its not working. ..eeeeh

why the hell ms access does not support multiple statements.

can anyone help me on this..

thanks,
Danish
Reply With Quote
  #2  
Old 06-18-2007, 01:53 PM
ofilha ofilha is offline
Registered User
 
Join Date: Jun 2007
Posts: 6
multiple queries

Hi,
Have you found a solution?
I am going through the same problem. I would like to create multiple queries from the SQLView but it won't let me. It gives me the same error message you received.
thanks
Ofilha
Reply With Quote
  #3  
Old 06-20-2007, 10:56 AM
Allan Murphy Allan Murphy is offline
Registered User
 
Join Date: Oct 2006
Location: Sydney NSW Australia
Posts: 178
SQL coding

try this

dim sqltext as string

sqltext = "select * from temp"
docmd.runsql sqltext

sqltext ="drop table temp"
docmd.runsql sqltext

I found that when I copied the coding from the sql after creating a query the ; caused a lot of problems, using your example the sql for the query was shown as
select * from temp; but to run it using coding I had to remove the ; e.g. "select * from temp"
__________________
Allan
allanmurphy47@gmail.com
Reply With Quote
  #4  
Old 06-20-2007, 03:14 PM
ofilha ofilha is offline
Registered User
 
Join Date: Jun 2007
Posts: 6
multiple queries in SQL View

Hi,
I have had the same problem. I can only do one query at a time. If i try more than one after the semicolon, i get an error message just like the one described earlier.

I am using the query tool to create my queries. Your solution appears like VB code. Can we use VB code inside the queries? Or are you saying that i need to create a program to run my queries.

My question is probably rather newbie, but i don't have much experience with MS Access.
Thanks.
Reply With Quote
  #5  
Old 06-20-2007, 06:10 PM
Allan Murphy Allan Murphy is offline
Registered User
 
Join Date: Oct 2006
Location: Sydney NSW Australia
Posts: 178
SQL question

It is VBA code Visual Basic for Access.

No, you cannot run VB code inside a query.

If you are just creating queries and then running them after each other then you can create a module or use code for when you click on a button to run your queries.

Module code
Sub run_queries()
docmd.openquery "query 1 name"
docmd.openquery "qury 2 name"
end sub

Button
sub update_results()
docmd.openquery "query 1 name"
docmd.openquery "qury 2 name"

end sub

I am using the query tool to create my queries. Your solution appears like VB code. Can we use VB code inside the queries? Or are you saying that i need to create a program to run my queries.

My question is probably rather newbie, but i don't have much experience with MS Access.
__________________
Allan
allanmurphy47@gmail.com
Reply With Quote
  #6  
Old 06-20-2007, 06:12 PM
Allan Murphy Allan Murphy is offline
Registered User
 
Join Date: Oct 2006
Location: Sydney NSW Australia
Posts: 178
Sql Query

Please ignore the last two paragraphs in the previous post.

Copy and paste error.
__________________
Allan
allanmurphy47@gmail.com
Reply With Quote
  #7  
Old 06-21-2007, 01:31 AM
ofilha ofilha is offline
Registered User
 
Join Date: Jun 2007
Posts: 6
Smile queries

Thanks much Allan,
I will give it a try and will keep you posted.
Reply With Quote
Reply Post New Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes 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 Off
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:29 AM.


DatabaseJournal Recent Articles


 » Configuring Oracle as a Data Source for SQ...

 » Tips for Simplifying Crosstab Query Statem...

 » Redmond exploits MySQL uncertainty

 » Oracle Launches Oracle Global Trade Manage...

 » SQL Server 2008 RTM Support Ends April 13,...

Search Database Journal:
 








Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.