Solved

Update query in MySQL crashing access, runs fine against MSSQL

Posted on 2013-06-20
4
547 Views
Last Modified: 2013-06-26
I am in the middle of trying to convert my first database from MSSQL to MySQL. The code in question is this:

Update Orders 
Set Paid=1 
Where 
(Select Sum(PaymentAmount) 
ordersFrom Payment 
Where Payment.InvoiceNumber=Orders.OrderNumber)>=InvoiceTotal

Open in new window


The objective is to mark all orders as paid if the customer has made sufficient payments. Payments are entered into a separate system and not directly onto the order form.

There are over 67000 payments in the payment  table, and over 70000 orders in the order table.

When running the code in an Access ADP file, in Access 2010 against the MSSQL server, it runs fine. When running the code in MySQL Workbench, the code runs fine. When running the code in an Access 2010 MDB file against the MySQL server, Access crashes with the following error in the Windows 7 64bit workstation event log:

Faulting application name: MSACCESS.EXE, version: 14.0.6024.1000, time stamp: 0x4d83e4fc
Faulting module name: ntdll.dll, version: 6.1.7601.17725, time stamp: 0x4ec49b8f
Exception code: 0xc0000374
Fault offset: 0x000ce6c3
Faulting process id: 0x878
Faulting application start time: 0x01ce6dcd7aa3a1a4
Faulting application path: C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE
Faulting module path: C:\Windows\SysWOW64\ntdll.dll
Report Id: c60ea7c2-d9c0-11e2-9dbb-000a3a56e2a7

Open in new window


The MySQL instance is 5.6.11 and the MSSQL instance is 2012 express. The server is a C2D 6600 2.4Ghz with 6GB RAM box.

Suggestions?
0
Comment
Question by:AMPLECOMPUTERS
  • 3
4 Comments
 
LVL 15

Assisted Solution

by:gplana
gplana earned 100 total points
ID: 39263089
Try this one:

Update Orders 
Set Paid=1 
Where InvoiceTotal <= 
(Select Sum(PaymentAmount)  orders
From Payment 
Where Payment.InvoiceNumber=Orders.OrderNumber);

Open in new window


Is it failing too?
0
 

Author Comment

by:AMPLECOMPUTERS
ID: 39263490
Running that code gives me a syntax error in Access, it says:

Run-time error '3075':

Syntax error in query expression 'InvoiceTotal<=(Select Sum(PaymentAmount) orders from Payment...blah blah blah.

If I remove the word "orders" from line 4, then it crashes Access just like my code did. It runs either way just fine from the Workbench.
0
 

Accepted Solution

by:
AMPLECOMPUTERS earned 0 total points
ID: 39266466
I have no idea what happened, but I had another place in the database with the same code, and it ran fine. I copies and pasted it into the form that was blowing up, still runs fine. I think the form was corrupt somehow so just to be sure I did a decompile and recompile.

Regardless, the problem is solved.
0
 

Author Closing Comment

by:AMPLECOMPUTERS
ID: 39277391
I will award 100 for trying, at least it made me really look hard a the database which did lead to a solution.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now