By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,701 Members | 2,006 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,701 IT Pros & Developers. It's quick & easy.

Connecting to MySQL at Startup

P: n/a
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!
Mar 15 '08 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Sat, 15 Mar 2008 12:10:47 -0700 (PDT), WPW07 <ww********@gmail.com>
wrote:

An ODBC datasource (DSN) can be created by adding the right entries to
the registry. Just run regedit.exe and search for one by name. You can
export the key, and then import it using a command line: regedit.exe
your.reg

Reattach code is a FAQ. You should have no problem finding
suggestions. Keyword: RefreshLink

-Tom.

>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!
Mar 15 '08 #2

P: n/a
DFS
WPW07 wrote:
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!
What I do is on my development system I create the ODBC datasource and all
table links.

Then in the code that executes at startup I re/create the ODBC datasource

dim cTxt As String
cTxt = "Description=building photos"
cTxt = cTxt & Chr(13) & "Database=PHOTOS"
cTxt = cTxt & Chr(13) & "Server=192.111.111.11"
DBEngine.RegisterDatabase "BldgPhotos", "SQL Server", True, cTxt


Mar 16 '08 #3

P: n/a
On Mar 15, 8:58 pm, "DFS" <nospam@dfs_.comwrote:
WPW07 wrote:
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!

What I do is on my development system I create the ODBC datasource and all
table links.

Then in the code that executes at startup I re/create the ODBC datasource

dim cTxt As String
cTxt = "Description=building photos"
cTxt = cTxt & Chr(13) & "Database=PHOTOS"
cTxt = cTxt & Chr(13) & "Server=192.111.111.11"
DBEngine.RegisterDatabase "BldgPhotos", "SQL Server", True, cTxt
Thanks DFS. That's exactly what I'm looking to do. Just one
question. Where do I find the "code that executes at startup" so that
I add the ODBC datasource code?
Mar 16 '08 #4

P: n/a
DFS
WPW07 wrote:
On Mar 15, 8:58 pm, "DFS" <nospam@dfs_.comwrote:
>WPW07 wrote:
>>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!

What I do is on my development system I create the ODBC datasource
and all table links.

Then in the code that executes at startup I re/create the ODBC
datasource

dim cTxt As String
cTxt = "Description=building photos"
cTxt = cTxt & Chr(13) & "Database=PHOTOS"
cTxt = cTxt & Chr(13) & "Server=192.111.111.11"
DBEngine.RegisterDatabase "BldgPhotos", "SQL Server", True, cTxt

Thanks DFS. That's exactly what I'm looking to do. Just one
question. Where do I find the "code that executes at startup" so that
I add the ODBC datasource code?
Create a Public Function (in a module) that gets called from a macro named
'autoexec'.

Mar 16 '08 #5

P: n/a
On Mar 15, 9:22 pm, "DFS" <nospam@dfs_.comwrote:
WPW07 wrote:
On Mar 15, 8:58 pm, "DFS" <nospam@dfs_.comwrote:
WPW07 wrote:
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!
What I do is on my development system I create the ODBC datasource
and all table links.
Then in the code that executes at startup I re/create the ODBC
datasource
dim cTxt As String
cTxt = "Description=building photos"
cTxt = cTxt & Chr(13) & "Database=PHOTOS"
cTxt = cTxt & Chr(13) & "Server=192.111.111.11"
DBEngine.RegisterDatabase "BldgPhotos", "SQL Server", True, cTxt
Thanks DFS. That's exactly what I'm looking to do. Just one
question. Where do I find the "code that executes at startup" so that
I add the ODBC datasource code?

Create a Public Function (in a module) that gets called from a macro named
'autoexec'.

Great...thanks again!

Mar 16 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.