Well. I have had to sort out a report for someone who likes using Microsoft Access.

We use the MySQL ODBC driver, called MyODBC Connector. But its relationship with Access is riddled with bugs. Can’t decide who to blame, but its pretty horrific.

So I created a blank Access database and connected the tables I required for my report. Alas, one of the fields has a name length of 16 or so characters, so this crashes Access completely. Great.

I made a copy of the MySQL table and renamed it to something shorter. This worked. So, I needed to alias the table somehow.

I created a VIEW in MySQL with a shorter name:

CREATE VIEW smallname SELECT * FROM longernamedtable;

I was able to link this in Access fine. Not a problem, however, all the VARCHAR fields in the view came out as chinese characters. AARGH

So, I managed to utililise the MERGE engine. Here goes:

CREATE TABLE smallname SELECT * FROM longernamedtable;
DELETE FROM smallname;
ALTER TABLE smallname UNION=(longernamedtable);

Now, we have a mirrored table. Brilliant. It linked to Access fine, and the VARCHAR’s were back to normal.

Thought I would share that with you. Because this little problem was starting to drain all the life out of me…


PS. The tables need to be ISAM for this to work.

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.