Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 512815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:21:30+00:00 2026-05-13T07:21:30+00:00

I have a text file with a few SQL statements in it that I

  • 0

I have a text file with a few SQL statements in it that I want to run
on an Access database. I thought that should be possible with Access’
Query Editor. So, I go into this editor and paste the statements:

insert into aFewYears (yr) values ('2000')
insert into aFewYears (yr) values ('2001')
insert into aFewYears (yr) values ('2002')
insert into aFewYears (yr) values ('2003')

Trying to run them (by hitting the red exclamation mark) I receive a
Missing semicolon (;) at end of SQL statement.

This could be taken as an indication that the editor would allow to execute
multiple statements. So, I change the statements and append such a
semicolon at the end:

insert into aFewYears (yr) values ('2000');
insert into aFewYears (yr) values ('2001');
insert into aFewYears (yr) values ('2002');
insert into aFewYears (yr) values ('2003');

Then I get a
Characters found after end of SQL statement.
which probably could be taken as an indication that it is not possible
to execute multiple statements.

Ok, so the question: is it possible to execute multiple statements in the
query editor, or is it possible to somehow batch-execute sql statements in a
file in/on/against Access.

Thanks / Rene

edit The insert statements were used as an example and I realize that they are less than perfect, because they all go to the same table and such a thing can obviously somehow be solved by using one statement that has a union or something. In my actual case that I am trying to solve, the file contains not only insert statements but also create table statements and insert statements with different underlying tables. So I hoped (and still hope) that there is something like my beloved SQL*Plus for Oracle that can execute a file with all kinds of SQL Statements.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:21:31+00:00Added an answer on May 13, 2026 at 7:21 am

    You can easily write a bit code that will read in a file. You can either assume one sql statement per line, or assume the ;

    So, assuming you have a text file such as:

    insert into tblTest (t1) values ('2000');
    
    update tbltest set t1 = '2222'
           where id = 5;
    
    
    insert into tblTest (t1,t2,t3) 
           values ('2001','2002','2003');
    

    Note the in the above text file we free to have sql statements on more then one line.

    the code you can use to read + run the above script is:

    Sub SqlScripts()
    
       Dim vSql       As Variant
       Dim vSqls      As Variant
       Dim strSql     As String
       Dim intF       As Integer
    
       intF = FreeFile()
       Open "c:\sql.txt" For Input As #intF
       strSql = input(LOF(intF), #intF)
       Close intF
       vSql = Split(strSql, ";")
    
       On Error Resume Next
       For Each vSqls In vSql
          CurrentDb.Execute vSqls
       Next
    
    End Sub
    

    You could expand on placing some error msg if the one statement don’t work, such as

    if err.number <> 0 then
       debug.print "sql err" & err.Descripiton & "-->" vSqls
    end dif
    

    Regardless, the above split() and string read does alow your sql to be on more then one line…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 285k
  • Answers 285k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer When you use VDEF to calculate an average, it will… May 13, 2026 at 4:46 pm
  • Editorial Team
    Editorial Team added an answer Maybe this helps you: http://www.scribd.com/doc/2569355/Geo-Distance-Search-with-MySQL It is a nice introduction.… May 13, 2026 at 4:46 pm
  • Editorial Team
    Editorial Team added an answer It should probably look like something like that: urlpatterns =… May 13, 2026 at 4:46 pm

Related Questions

The production change implementers for our IT group have been tasked with reviewing the
I have to import a large mysql dump (up to 10G). However the sql
Scenario: I load some data into a local MySQL database each day, about 2
I have this Linq to SQL query sequence that is basically returning a search
I will likely be responsible for porting a vb6 application to c#. This application

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.