Connecting to MySQL at Startup

Hello,

I've installed the ODBC connector for MySQL and can go into Access and
manually link to the MySQL tables.  Everything works fine this way.

But rather than go into the Windows Data Source Adminstrator on each
user's computer, how would you code an MS Access front end to connect
to MySQL tables at startup?  Where would you put the code and how
would you call it when the Access database is opened?

Thanks for your help!
0
WPW07
3/15/2008 4:46:57 PM
access 16762 articles. 3 followers. Follow

4 Replies
1011 Views

Similar Articles

[PageSpeed] 39

It will be assumed that your database gets installed on each pc.

I explain why here:
http://www.members.shaw.ca/AlbertKallal/Articles/split/index.htm

Then, you can re-link with what is called a dns-less connection, and not 
have to open/use the data source administer.

The following shows how:

http://www.accessmvp.com/djsteele/DSNLessLinks.html

Using DSN-Less Connections
http://www.accessmvp.com/djsteele/DSNLessLinks.html


ODBC DSN-Less Connection Tutorial Part I
http://www.amazecreations.com/datafast/GetFile.aspx?file=ODBCTutor01.htm&Article=true
HOWTO: Use "DSN-Less" ODBC Connections with RDO and DAO
http://support.microsoft.com/?id=147875
ODBC DSN Less
http://www.able-consulting.com/MDAC/ADO/Connection/ODBC_DSNLess.htm


-- 
Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com 


0
Albert
3/15/2008 9:32:36 PM
Thank you Albert for the excellent information.  Just one question.
I'm looking at the tutorial part I.  I'm still unclear where you put
the code that calls the connection function.  Do I need to put it in
every form/report that links to the MySQL tables?  Or can I set it up
so the application calls the function once when started?  If so, where
would the code go? This is the code in the tutorial I'm referring to:

Function LinkToPubsAuthors()

        Dim db As DAO.Database
        Dim tdf As DAO.TableDef
        Set db = CurrentDb()
        Set tdf = db.CreateTableDef("Authors")
        tdf.SourceTableName = "Authors"

        tdf.Connect = "ODBC;FILEDSN=C:\Desktop\Pubs.dsn"

        db.TableDefs.Append tdf
        db.TableDefs.Refresh

        Set tdf = Nothing
        Set db = Nothing

    End Function


Thanks again...


On Mar 15, 4:32 pm, "Albert D. Kallal" <PleaseNOOOsPAMmkal...@msn.com>
wrote:
> It will be assumed that your database gets installed on each pc.
>
> I explain why here:http://www.members.shaw.ca/AlbertKallal/Articles/split/index.htm
>
> Then, you can re-link with what is called a dns-less connection, and not
> have to open/use the data source administer.
>
> The following shows how:




> http://www.accessmvp.com/djsteele/DSNLessLinks.html
>
> Using DSN-Less Connectionshttp://www.accessmvp.com/djsteele/DSNLessLinks.html
>
> ODBC DSN-Less Connection Tutorial Part Ihttp://www.amazecreations.com/datafast/GetFile.aspx?file=ODBCTutor01....
> HOWTO: Use "DSN-Less" ODBC Connections with RDO and DAOhttp://support.microsoft.com/?id=147875
> ODBC DSN Lesshttp://www.able-consulting.com/MDAC/ADO/Connection/ODBC_DSNLess.htm
>
> --
> Albert D. Kallal    (Access MVP)
> Edmonton, Alberta Canada
> pleaseNOOSpamKal...@msn.com

0
WPW07
3/16/2008 12:57:08 AM
You'd run the code once when the database opens. You can have the Autoexec 
macro call your function, or you can put it in the Open event of the initial 
form.

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"WPW07" <wwisnieski@gmail.com> wrote in message 
news:c53bffa3-6069-415b-90d5-df5fc418385e@a23g2000hsc.googlegroups.com...
> Thank you Albert for the excellent information.  Just one question.
> I'm looking at the tutorial part I.  I'm still unclear where you put
> the code that calls the connection function.  Do I need to put it in
> every form/report that links to the MySQL tables?  Or can I set it up
> so the application calls the function once when started?  If so, where
> would the code go? This is the code in the tutorial I'm referring to:
>
> Function LinkToPubsAuthors()
>
>        Dim db As DAO.Database
>        Dim tdf As DAO.TableDef
>        Set db = CurrentDb()
>        Set tdf = db.CreateTableDef("Authors")
>        tdf.SourceTableName = "Authors"
>
>        tdf.Connect = "ODBC;FILEDSN=C:\Desktop\Pubs.dsn"
>
>        db.TableDefs.Append tdf
>        db.TableDefs.Refresh
>
>        Set tdf = Nothing
>        Set db = Nothing
>
>    End Function
>
>
> Thanks again...
>
>
> On Mar 15, 4:32 pm, "Albert D. Kallal" <PleaseNOOOsPAMmkal...@msn.com>
> wrote:
>> It will be assumed that your database gets installed on each pc.
>>
>> I explain why 
>> here:http://www.members.shaw.ca/AlbertKallal/Articles/split/index.htm
>>
>> Then, you can re-link with what is called a dns-less connection, and not
>> have to open/use the data source administer.
>>
>> The following shows how:
>
>
>
>
>> http://www.accessmvp.com/djsteele/DSNLessLinks.html
>>
>> Using DSN-Less 
>> Connectionshttp://www.accessmvp.com/djsteele/DSNLessLinks.html
>>
>> ODBC DSN-Less Connection Tutorial Part 
>> Ihttp://www.amazecreations.com/datafast/GetFile.aspx?file=ODBCTutor01....
>> HOWTO: Use "DSN-Less" ODBC Connections with RDO and 
>> DAOhttp://support.microsoft.com/?id=147875
>> ODBC DSN 
>> Lesshttp://www.able-consulting.com/MDAC/ADO/Connection/ODBC_DSNLess.htm
>>
>> --
>> Albert D. Kallal    (Access MVP)
>> Edmonton, Alberta Canada
>> pleaseNOOSpamKal...@msn.com
> 


0
Douglas
3/16/2008 11:38:14 AM
Hello,

Can anyone point me to some simple examples of an ODBC connection
string function?  I just want a simple function that will connect to
my MySQL database.  I don't need it to create a table, etc.  I just
want a connection.  I will put it in a module and call it from the
AutoExec macro.

Thanks!




On Mar 16, 7:38 am, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> You'd run the code once when the database opens. You can have the Autoexec
> macro call your function, or you can put it in the Open event of the initial
> form.
>
> --
> Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
> (no private e-mails, please)
>
> "WPW07" <wwisnie...@gmail.com> wrote in message
>
> news:c53bffa3-6069-415b-90d5-df5fc418385e@a23g2000hsc.googlegroups.com...
>
> > Thank you Albert for the excellent information.  Just one question.
> > I'm looking at the tutorial part I.  I'm still unclear where you put
> > the code that calls the connection function.  Do I need to put it in
> > every form/report that links to the MySQL tables?  Or can I set it up
> > so the application calls the function once when started?  If so, where
> > would the code go? This is the code in the tutorial I'm referring to:
>
> > Function LinkToPubsAuthors()
>
> >        Dim db As DAO.Database
> >        Dim tdf As DAO.TableDef
> >        Set db = CurrentDb()
> >        Set tdf = db.CreateTableDef("Authors")
> >        tdf.SourceTableName = "Authors"
>
> >        tdf.Connect = "ODBC;FILEDSN=C:\Desktop\Pubs.dsn"
>
> >        db.TableDefs.Append tdf
> >        db.TableDefs.Refresh
>
> >        Set tdf = Nothing
> >        Set db = Nothing
>
> >    End Function
>
> > Thanks again...
>
> > On Mar 15, 4:32 pm, "Albert D. Kallal" <PleaseNOOOsPAMmkal...@msn.com>
> > wrote:
> >> It will be assumed that your database gets installed on each pc.
>
> >> I explain why
> >> here:http://www.members.shaw.ca/AlbertKallal/Articles/split/index.htm
>
> >> Then, you can re-link with what is called a dns-less connection, and not
> >> have to open/use the data source administer.
>
> >> The following shows how:
>
> >>http://www.accessmvp.com/djsteele/DSNLessLinks.html
>
> >> Using DSN-Less
> >> Connectionshttp://www.accessmvp.com/djsteele/DSNLessLinks.html
>
> >> ODBC DSN-Less Connection Tutorial Part
> >> Ihttp://www.amazecreations.com/datafast/GetFile.aspx?file=ODBCTutor01....
> >> HOWTO: Use "DSN-Less" ODBC Connections with RDO and
> >> DAOhttp://support.microsoft.com/?id=147875
> >> ODBC DSN
> >> Lesshttp://www.able-consulting.com/MDAC/ADO/Connection/ODBC_DSNLess.htm
>
> >> --
> >> Albert D. Kallal    (Access MVP)
> >> Edmonton, Alberta Canada
> >> pleaseNOOSpamKal...@msn.com

0
WPW07
3/19/2008 2:59:43 PM
Reply:

Similar Artilces:

Microsoft Document Connection gives error "Only connections to SharePoint or SkyDrive servers are supported."
Trying to connect to my SharePoint server using Microsoft Document Connection with Mac Office 2011. Getting this frustrating error: "Only connections to SharePoint or SkyDrive servers are supported." I have the full version of Mac Office 2011 (not student/teacher edition) and am running MOSS 2007 Service Pack 2 (12.0.0.6421) on my server. I have no problem connecting to SharePoint using anything else. Does anyone have any ideas? I have tried the basic authentication option, too but this has has no effect. Thanks in advance! Toby On Jan 25, 8:22=A0pm, Toby <tobybore...@gmail...

Outlook 2003: Cannot connect to Exchange Server 2000
We have installed Outlook 2003, and have configured it to connect to Exchange Server 2000. But each time we try to open any Exchange mailboxes in Outlook, we get the following error: "The set of folders could not be opened." The details button shows the follows: "This error usually appears if the OST or PST file you are using is: -Unavailable -Protected with file permissions -On a share on a server and the network is down -Corrupt To correct this problem, store the OST or PST file on the local computer. You may also want to run the scanost.exe and scanpst.exe tools t...

SBS Connectivity issues
Experiencing intermittent delays and dropped connections to Small Business Server. Config is: SBS2003 SP2 (all current patches) running on HP ML110 server; 4 PCs onsite - 3 used by onsite staff; 1 used by remote user to access server via RWW. Users run basic Office apps, Outlook, Quickbooks, internet access. Also have an Avaya VIOP phone system (4 phones) on the network. Everything has been in place for almost 4 years. Having more frequent connectivity issues. Onsite PCs show delays in Outlook connecting to Exchange ('Trying to connect ...). Remote user reports...

Outlook crash on startup
I have a user whose Outlook crashes on startup. It says that Outlook has encountered a problem and will close (faulting module is outllib.dll). The event from the application log is at the bottom of this message. If I delete her mail profile and recreate it, she can get open it. But, when she closes Outlook and tries to get back in, it crashes. I tried the steps from the MS article 291614, no help. We have ghosted her machine and it still happens. When I remove the folder list from the view, the problem does not occur and she can close and open Outlook fine. Event Type: Error...

ODBC Connection Not Connecting
I am using the below code to 1) automatically connect to a Microsoft ODBC for Oracle connection called "FIN_CUR" and 2) run an query on a linked table in FIN_CUR The issue i am having is that the ODBC connect part of the script appears to be working, but when it goes to try to run the query I still get the popup prompting for user name and password to make the connection to the ODBC. I have verify that the user name and password are correct, but don't know what I am missing. Here is my code Public Sub OraConnect() Dim strErr As String On Error GoTo...

Simultaneous socket connections. Is there a limit?
My client wants me to write an application that maintains 30 or 40 simultaneous socket connections to different hardware devices. For each device the throughput requirements are very small since only some small packets are sent occasionally at random intervals. Is there a simultaneous limit? 30 or 40 is far more then I have ever done. I don't want any surprises. Is there a limit? I assume XP Professional would handle this. Correct? Would XP Home be any different? My laptop has XP home. To certain incoming ports, its 10, although there are several cracks out their to remove this...

VPN can't connect to workstations
I am running a 2k3 network and I am trying to connect my laptop w/ Vista to it using VPN. I can connect to the server and use server shares with no problem. My problem is that it cannot connect to the workstations . Would appreciate any input on that. "john" <johnbahran@hotmail.com> said this in news item news:b4419f87-386b-41de-876a-e3546096ecc2@c34g2000yqn.googlegroups.com... > I am running a 2k3 network and I am trying to connect my laptop w/ > Vista to it using VPN. I can connect to the server and use server > shares with no problem. My problem is ...

Outlook Win98SE Trying to Connect to Server time out. IBM 390E & Rogers.com
I have loaded Win98SE and Office 97 on an IBM 390E laptop using IBM Etherjet 10/100 network card connected to a D- Link 714P+ 4-port wire&wireless cable router. Network file transfers work fine, IE 6 works fine. Outlook often hangs when it loads and trys to connect to the (Rogers.com) server to download email messages. I contacted Rogers tech support and all settings are correct. If I take the router out of the loop and connect directly to the cable modem - Outlooks works like a charm & fast downloading of messages. I have 3 other PCs connected on the LAN and all work fine...

IMAP: A connection to the server cannot be established
I have Outlook 2007 Installed on Two Separate PCs. One has Vista installed, and the other, Windows 7. McAfee Security Center is the Anti-Virus software unstalled on both PCs. I have setup 2 IMAP Accounts on each PC and can only get the ones on the Vista Box to work correctly. This is the error I keep getting on the Windows 7 Box: Task 'Synchronizing subscribed folders for [my-email-account].' reported error (0x800CCC0E) : 'Outlook cannot synchronize subscribed folders for [my-email-account]. Error: Cannot connect to the server. If you continue to receive this ...

server connect
When I first start up Outlook 2003, it contacts the mail server and everything is hunky-doory. However, when attempting to next access the mail account by the send/receive access or in background, it indicates that it cannot locate the server and gives me error (0x80004210A). This error number is not consistent other than for the 0x800 portion. The location does not change, so how can it find it initially, and not later on? I'm confused. What type of mail server? POP3, IMAP, Exchange, HTTP, Other...? Does the same happen when you disable your firewall and/or virusscanner (integra...

Excel slow to load blank workbook on startup
Hi Excel 2003 Excel opens quickly to display the program frame but with the grey background instead of the cells of the initial worksheet. About 5-10 seconds later it loads the worksheet. It might be loading it from our companies slow server. What is the standard workbook that it's trying to load? What is it called? Is there path to it in Options? If there is I can't see it :-( Hope you can help me. Cheers Dave F. Excel isn't like MSWord. There are no standard workbooks that have to be opened when excel opens. Each user does have the option of adding any workbooks he or ...

Hotmail connection
I'm new to Microsoft Outlook, and want to view and send email using Microsoft Outlook. I have used Hotmail for quite a while, and am looking for a method of "re-routing". (?) I played around with the configurations, but still could not connect to my hotmail accout through Outlook. Can any one help? Thanks. Which version of Outlook? Microsoft(R) Outlook(R) (9.0.0.2711) Internet Mail Only Copyright (c) 1995-1999 Microsoft Corp. All rights reserved. "miker67@gmail.com" wrote: > Which version of Outlook? > > zephyrus17 <zephyrus17@discussions.micros...

Intranet Connection
This is a multi-part message in MIME format. ------=_NextPart_000_0022_01C3CF10.F7EDF7A0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable I am trying to connect 5 computers using Outlook XP intranet. What is = the best way to connect them....using MS mail, MS Exchange, etc. Thanks Douglas ------=_NextPart_000_0022_01C3CF10.F7EDF7A0 Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD>...

IE8 and Firefox won't connect to Yuku?
I've been having an issue tonight where my internet won't connect to the Yuku site first on IE8 then on Firefox, both sites got the same screen telling me it's an inactive site and I have connection issues. I ran the trouble shooter and it's telling me I don't have an issue? I'm on Windows 7 upgrade from XP, Windows Firewall is on, spyware is AVG and Spybot. I checked all the settings and nothing looked different as I was on the site like 2 days ago. Any ideas on what the problem is? Maybe you do have connection issues? 4thjet wrote: > I've been ...

Maintain network connectivity on shutdown?
Hello, we have added a script to run at Windows shutdown and in testing it seems to at least run, but the problem is part of the script process that needs to access a server on our network fails because it appears that network connectivity has been dropped at this point in the shutdown process. Is there any way to set it so that network connectivity is retained on shutdown? For example, if there is still at least IP connectivity (but the WINS service has been shutdown), then could we run something on a command line to invoke the network resource? Any help would be greatly appreci...

No Internet connections in Network connections!!!
Hi im new to this forum and really need help. Yesterday I decided to set up my computer again (It had been in the garage because I wasn't using it for a while). Anyways, when I first started it up it worked fine and the internet connection worked as well. Later on it began to shut off unexpectedly if i tried to remove a program through task manager that wasn't working, so since it didn't have any important data, I decided to reformat my hardrive and reinstall microsoft xp. When I started up my cpu again, I noticed that there were no connections, even though I had not unp...

Remotely connect to SBS 2003
I'm a little new here. Trying to remotely connect to a SBS2003 server. However, the ISP uses DHCP to assign addresses so every 2 days the external IP changes. How can I connect to the server without asking someone at the office to give me the new external IP all the time? I've already assigned a static IP to the server in the range of 192.168.1.XXX and allowed port 3389 to that address in the router. I can connect fine when I have the correct external IP. Thanks in advance! R. Hi Remi: Welcome..... You should have a static IP address, or a dynamic to static t...

Problem connecting socket
On one machine I am having problems making a socket connection. When I try to connect, I immediately get an FD_CONNECT notification response with a WSAENOTCONN error. Sometimes the connection works; most of the time it doesn't. I don't think I am doing anything fancy. The code has not changed and has been working for awhile. Suddenly this machine seems to have a problem. Below is the connection code without the notification code. Can someone think of something to look for? Thanks /*******************/ /* Create a socket */ /*******************/ m_hSocket = socket(PF_INET,...

Connections in Exchange 2003 server showing 2 connections.
My exchange server keeps giving me the following error in the event log: Event Type: Error Event Source: MSExchangeTransport Event Category: Routing Engine/Service Event ID: 929 Date: 9/21/2004 Time: 1:15:24 PM User: N/A Computer: EXCHANGE Description: Failed in reading Connector's DS Info Process Id: 1940 Process location: C:\WINDOWS\system32\inetsrv\inetinfo.exe ConnectorDN: CN=IST external mail,CN=Connections,CN=First Routing Group,CN=Routing Groups,CN=First Administrative Group,CN=Administrative Gr...

How to connect Outlook To Aol for email?
How to connect Outlook To Aol for email? Thanks In article <0d5001c3bfee$53823630$a301280a@phx.gbl>, power4fl@bellsouth.net says... |How to connect Outlook To Aol for email? | |Thanks | You can't directly. I believe there is a third-party program that will do it for you. Try a google search. ...

no connection
When I try to 'send and recieve' I get a message "mail.bellsouth.netproperties not responding" I know some setting is messed up,but what & where? Thanks Has this account ever worked? Please post any error message in its entirety. You can left click on it to highlight and then right click to copy and then paste it into this thread. -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "flhxcharlie" <flhxcharlie@discussions.microsoft.com> wrote in message news:BDB240CE-E063-4C5C-A1D0-38E01B3A2D4C@microsoft.com... ...

Connection Error Issues
I am working in SSRS 2005, and am building "ad hoc" reports with parameters in VS2005. Everything runs well with in VS 2005, I build and deploy the reports, with no issue, and they run fine in Report Manager. Then the report viewer is linked to a website that essentially lists the avaible reports. Here is the issue, the end user can access the webpage but when they click the link to the report it throws a connection error such as: "An error has occurred during report processing. (rsProcessingAborted) Query execution failed for data set 'DataSet1'. (rsErrorExe...

CONNECT
How do you connect to CRM? I have it installed, The snap in works, but I just cant figure out how to access it yet.I don't have sales for outlook installed yet, but I thought you could access it via a web interface? ...

How do I setup outlook connect to corportate email
I'm trying to setup my home computer to receive my corportate email. When I try to setup exchange client from the instructions provided from my employer. I go to Connections and in this box I'm to click on "Connect to my Exchange mailbox using HTTP". But I don't have this option is there an upgrade I need. I'm using Office 2003 standard addition. James wrote: > I'm trying to setup my home computer to receive my corportate email. When I > try to setup exchange client from the instructions provided from my employer. > I go to Connections and in ...

Connect Exchjange 2003 to Internet to Get Incoming Mail
Hi All, I have Exchange 2003, I use it internaly in my LAN but I do not have any real IP to publish it, so I can Send from my client - outlook - that is configured with my Exchange Server 2003, but of course I cannot receive from Internet via my Exchange Server. So, I have to configure my mail client using POP3 to collect my Incoming e-mails from outside server that's of my ISP or open Web Interface of this web server to get my incoming mail messages. So, I'd like to configure my Exchange Server to collect these incoming messages and all of my clients only be configured with the ...