Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 5th, 2007, 02:41 PM
Registered User
 
Join Date: Aug 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Enabling error messages

I've tried docmd.setwarnings(warningson) and docmd.setwarnings true but here's my problem. The following line:

cn.Open "Driver={MySQL ODBC 3.51 Driver};Server=74.1.1.4;Port=3306;Database=data_ba se;User=user_name;Password=pass123;Option=3;"

just fails miserably. The program just... stops right there. That line, and everything afterwards, simply fails to execute. I've tried figuring it out, but with no error messages it's impossible, and the yahoo who wrote this thing has disabled them somehow.

Thanks. Please save my sanity!

-DW

 
Old September 6th, 2007, 06:40 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

That looks pretty straightforward, except for the {}. Those aren't used in VBA. Did you put them in there?

Anyway, there is probably one of these at the top of the sub:

On Error Resume Next

Just rem out that line with a ' at the beginning, and the server will start sending errors again.

Alternatively, you can check for the errors yourself:

Err.Clear
cn.Open "Driver={MySQL ODBC 3.51 Driver};Server=74.1.1.4;Port=3306;Database=data_ba se;User=user_name;Password=pass123;Option=3;"
If Err <> 0 Then
   MsgBox 'error items you want to see like Err.Description, Err.Number, Err.Source, Err.HelpFile, etc.
End IF
Err.Clear

Did that help?

mmcdonal
 
Old September 6th, 2007, 11:06 AM
Registered User
 
Join Date: Aug 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Indeed!
Thanks!

By the way, the answer was simple. In all the documentation I've seen, the cn.open command was given with the connection string afterwards as a parameter.

What I ended up doing was:
(capitalization of for emphasis)
cn.CONNECTIONSTRING = "Driver={...."
and then simply:

cn.open

with no parameters afterwards. Worked like a charm

BTW the {} brackets are part of a standard MySQL connection string. They're not VBA, they're actually what gets fed to the server/ODBC engine.

Cheers!






Similar Threads
Thread Thread Starter Forum Replies Last Post
error messages strt_prg Struts 1 November 13th, 2006 07:05 AM
error messages timbal25 Classic ASP Databases 0 August 1st, 2006 02:56 PM
customer Error Messages testsubject Visual Studio 2005 5 March 2nd, 2006 06:03 AM
Error messages ldoodle Access ASP 12 June 6th, 2005 01:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.