472,347 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,347 software developers and data experts.

Using MS Access as a front end and trying to run a script

Does anyone know how I can use vba in access to run a script that is stored
as a file. I can make a connection to mysql database and run sql statements
but this sql statement is very long (creates many tables with hundreds of
fields). I can run the script in the mysql interface but I want to do this
from my access front end to make it easy for the user to set up the tables.
I need something like
myconnection.execute ("c:\myfiles\myscript.sql)
but obviously this does not work.
Alex
Jul 20 '05 #1
1 1890
On Sun, 02 Jan 2005 22:44:01 +0000, Paradigm wrote:
Does anyone know how I can use vba in access to run a script that is
stored as a file. I can make a connection to mysql database and run sql
statements but this sql statement is very long (creates many tables with
hundreds of fields). I can run the script in the mysql interface but I
want to do this from my access front end to make it easy for the user to
set up the tables. I need something like myconnection.execute
("c:\myfiles\myscript.sql) but obviously this does not work.
Alex


The best way to use Access/VBA with MySQL is to use the ODBC driver and
create linked tables to your MySQL tables. Having accomplished this, you
can treat your MySQL database as you would an ordinary Access database.

Your "myconnection.execute" example would not work because it requires a
string argument that is one single SQL statement. There are
several things you can do.

You can park each SQL statemnt in your script in an individual Access
query. Name your queries Query_01, Query_02, ... Query_NN. Now you can use
your VBA to loop execute each query in turn. NB: Make sure to define your
queries as sql PASSTHROUGH if you are using pure MySQL syntax.

OR

Write your VBA code to read the the [myscript.sql] file and pass each
single query statement to the connection .execute method in turn. All you
need do is assemble each line into a string (DIM sql As String). When you
encounter the ";" terminating line, you stop reading the file,
"myconnection.execute sql", sql = "", then continue reading the file.
Again, if you are using MySQL syntax, you need to be sure you define your
connection as type PASSTHROUGH.

It really isn't complicated if you are familiar with VBA together with ADO
or DAO. I use Access all the time to get around the MySQL 4.0x lack of
stored procedures.

If you get stuck, give another shout.
Thomas Bartkus

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Richard Muller | last post by:
Hi All, I've got the ASP script shown below that complains as follows: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) Data source...
38
by: Remco Groot Beumer | last post by:
Hello, I'm trying to decide if the following situation would be workable: Generate an MS Access Front End (which will run localy on client...
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode...
10
by: Scott | last post by:
I have written an Access application that our employees use on a daily basis to enter information. It's comprises of a series of forms, a few...
1
by: Jim Devenish | last post by:
I am continuing my exploration about upsizing to SQLServer from Access 2000. I have a split database with a front-end and a back-end, each of...
5
by: IkBenHet | last post by:
Hello, I use this script to upload image files to a folder on a IIS6 server: ******************* START UPLOAD.ASPX FILE...
35
by: robert d via AccessMonster.com | last post by:
I was asked to provide a proposal. I provided a proposal on my application and the prospective client likes what I have but is wary of it having...
2
by: PokerJoker | last post by:
on click of a link, i'm sending an ajax call to the server, grabbing relevant data, and trying to display it by adding a datagrid to a hidden div,...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.