[dba-SQLServer] MySQL not MS SQL question

Arthur Fuller fuller.artful at gmail.com
Mon Feb 25 11:10:00 CST 2013


Well, after much experimenting, I am about halfway to my goal. First, a
brief description of the scenario:

1. Access 2007 Front End; MySQL Back End, MySQL ODBC 5.2a Driver.
2. Database was ported from Access to MySQL using a utility called MS
Access to MySQL (Freeware/DonationWare)
3. Navicat MySQL admin tool.

Initially I set up a link to the MySQL database (External Data|More|MySQL
ODBC, selected all the tables).

In Navicat I created a couple of Views and Stored Procedures in the MySQL
database.

I created a new connection as before (External Data etc.). This time my two
new Views were understood as Tables. I selected the two Views and linked to
them.

I swtiched to Access and there were the two new Views, listed as Tables.

I opened one, then created a form in the usual way. I opened the other and
created a form, then closed it.

I switched Form1 into design mode, then added a subform and selected the
form just created (Form2).

This worked just as hoped. Success, as far as it goes. However it does not
go as far as I want.

What I want to do next is bind a form to the result set returned by a
Stored Procedure in the MySQL back end.

None of the "obvious" approaches works. So now I'm thinking that what I
have to do is:

1. create a command object within VBA code. (Perhaps create a new
connection object, too; not sure about that yet.)
2. Populate its attributes with procedure name, indicate that it is a SP.
3. Add parameter objects to suit.
4. Execute the command, assigning the result set to a recordset.
5. Set the form's RecordSet to the recordset just created.
6. In the form close event, close my recordset and set it to nothing.

Does that sound about right? Have I overlooked anything?

One thing that I do know in advance is that I'm puzzled about the parameter
objects. With some exploration I hope to clear up my haze.

Does anyone have an example of code that does this, ideally to a non-MS SQL
database?

TIA,
Arthur


More information about the dba-SQLServer mailing list