Exporting Form INSERT Queries from Microsoft Access 2007 to MySQL - mysql

I have inherited a MS Access DB (2007) which I am converting into a MySQL database. I have exported all the custom queries with no issues. But I cannot find the form INSERT query.
The DB has a form which contains sub-forms. There is one submit button which onclick validates the form and then calls acCmdSaveRecord which presumably inserts the record into the database.
Because the database schema is a moderately complex RDB I want to be able to view or export the INSERT query Access runs when saving a record so I can convert it to MySQL.
Is this possible and if so how would I do it?

You can't. That is done by Access behind the scene when using a bound form.
If you link the table from MySQL and bind your (sub)forms to the updated tables and views, the forms will still read and write your data.

Related

Refresh Data in Access 2016 from Read-Only MySQL ODBC`

I am attempting to "sync" data from a read-only ODBC MySQL server to Access 2016. I need to move the data into Access so that I can more easily manipulate and create better customized reports.
I have linked the data tables between Access and MySQL, however I cannot get the data in these tables to automatically refresh. I must go into Access and hit "Refresh All".
What I'm looking to do is update all of my open tables in Access once nightly so that each morning the data used to build these reports is new. Currently if I leave these tables all evening, when I get in the next morning I must hit "Refresh-All" for Access to go retrieve the most recent data.
Any ideas?
The data in linked tables is automatically refreshed by access when you attempt to read them. You can do that by displaying a datasheet view of the database, or by a form where the linked table is the data source. Beware, we have had problems which tables with lots of records being the source for drop down lists, having the database locked.
Access only does this properly (and at speed) if either the underlying table has a unique clustered index, or after having linked the tables you create an index in access.
If you want to create a copy that you can manipulate (such as write to) and the underlying tables are read only, then you will have to create matching unlinked tables and execute some form of copy sql and appropriate points in your application.

Connecting Access with SAS

I have a decent amount of experience with SAS and Access, and I know how to call Access from VBA, but I am having a problem with table locks that I need help with.
Essentially what I am doing is running a proc freq in SAS, passing it to a table in Access so it can be read in a subform.
I have a form with some combo boxes where the user can select info about what variable they want the frequency of. Then they click a button and VBA passes those parameters on to SAS, and the subform populates with frequency data from SAS.
Everything works except the final part.
I have successfully taken the parameters from Access, passed them to SAS, and run the correct frequency. But during SAS's proc export back to Access, I get an error stating: "Exectute: The database engine could not lock table "FREQ" because it is already in use by another person or process."
The issue is that the table that SAS is exporting to is used in Access by the form that opens SAS.
Since I am obviously not using the form while SAS is processing, is there a way to have the form unlock or disconnect from the table so that SAS can access it, and then reconnect the table to the form after SAS finishes processing?
I tried splitting the database, but I got the same problem.
The problem maybe was caused by the fact that the SAS was connecting with the ACCESS. First clear the connection(such as: libname libname_name clear), and then connect with Access.

How to run append query from data macro MS Access?

I have 2 table, one is local named 'Client' and other is a linked table to MySQL DB in my web-server named 'ClientSql'.
When I insert data into the table Client, I want it to be insert into clientSql too. I try it with data macro (after insert), but it shows me an error saying
It's not possible in linked tables.
I have tried to create an append query successfully, and it works, but it just works if I execute it manually. My question is:
Is it possible to call it from a data macro? if is possible, can you show me how? If not, can you point me to a solution?
I'm not sure why you should be able to do it manually, but not via a macro. According to this link
http://dev.mysql.com/doc/connector-odbc/en/connector-odbc-examples-tools-with-access-linked-tables.html
you should be able to do it either way.
Another thought is to eliminate the local access client table and have the access program update the mySql table directly. However, if another program is accessing the client table at the same time, this could become tricky due to multi-user and locking situations.

What's an alternative to triggers when using a Jet tables in an Access Database (mdb file)?

I have this project that would require users to check in/out through a finger print reader ZK SF200.
The system that I am building needs to fetch new data that is added into this machine's database which unfortunately is a MS Access mdb file.
In my limited experience in MS Access databases, I managed to link this file to my MySql database table which allows me to manually do the insert from MS Access.
All I want to do now is to create some form of trigger that would add data to my MySql database when new rows are inserted into the MS Access table.
This problem would have been solved if the file type was .accdb because we can use After Insert events however it is an mbd type so those are not supported.
Any idea on how I can solve this matter ?
As a final note: I am willing to change DBMS in case MySql is the obstacle here. Would creating a linked server or doing sql server replication through mssql 2008 r2 work ?
EDIT: I need to insert data to MySql table because I have a trigger implemented there which does its side of logical manipulation of the data (ex: Increment the number of visits for the customer, check if customer subscription has expired or not and update the customer status accordingly)
Thank you.
Linking a table in MS-Access to the ODBC source is probably an answer for you. The table in MS-Access will be more like a view on the source table. Any DML operation (INSERT, UPDATE, DELETE) will be synced immediately with the source database. You will not need any trigger, which is not available in MS-Access (unless some VBA expert knows a solution).
The Linked table technology is default available for SQL-server, but since it uses ODBC I quess you can use it with MySQL too.

How do i run a SQL query against an Access database to get a complete dump of tables and records via Excel?

I have an Access database that i need a complete dump of into Excel to import into another data source.
Is there a way i could run a SQL query using "Get External Data" function from Excel and if so what should the query look like?
Try using Microsoft Query and access Access, http://office.microsoft.com/en-us/excel-help/use-microsoft-query-to-retrieve-external-data-HA010099664.aspx. There's an option to "View data or edit Query in Microsoft Query".
This is for a SQL database, however you can use the same principal and just change the connection string to Access. Then, you would loop through the Tables collection, and within that loop you would loop through the Fields collection using something like this.
Also, have a look here and see the syntax used to loop through the Access tables collection using ADOX from Excel.