Go Back   Access World Forums > Apps and Windows > VB.NET

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 05-17-2015, 11:54 PM   #1
Cancer69
Newly Registered User
 
Join Date: May 2015
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Cancer69 is on a distinguished road
Dynamics MS Access Connection

Hello everyone. I'm newbie here in the forum. This is my first thread.

I am using the following codes to connect to MS Access database using vb.net code. I am providing the file path name and directory. This codes work fine in my computer. How can I make this codes as dynamics connection that can run to another computer that no need to change the path. I'm using MS Access 2013 and Visual Studio 2008 (VB.NET). Below is the connection string code i used to connect to database in VB.NET form. So, how and what is the connection string I will be going to use in my form. Thank you very much.

below is my hard coded connection string which is working file.


Dim conn AsNew System.Data.OleDb.OleDbConnection()
conn.ConnectionString =
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\JV\Desktop\MyVBProject\FeedBackSys tem\KPI.accdb"

Then I change to this code and I'm getting error. It say "Could not find the file. C:\Users\JV\Desktop\MyVBProject\FeedBackSystem\bin \x86\Debug\KPI.accdb"


Dim conn AsNew System.Data.OleDb.OleDbConnection()
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source= |DataDirectory|\KPI.accdb"




Cancer69 is offline   Reply With Quote
Old 05-18-2015, 05:17 AM   #2
Ranman256
Newly Registered User
 
Join Date: Apr 2015
Location: KY,USA
Posts: 2,594
Thanks: 0
Thanked 551 Times in 537 Posts
Ranman256 will become famous soon enough
Re: Dynamics MS Access Connection

Can you not just LINK the tables using this connection, and forgo any VB code?
Ranman256 is offline   Reply With Quote
Old 05-18-2015, 09:12 PM   #3
Cancer69
Newly Registered User
 
Join Date: May 2015
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Cancer69 is on a distinguished road
Re: Dynamics MS Access Connection

Anybody can give an idea on how to fix this issue. Also, I'm bothering me. I am testing my application and the database access is stored in bin/x86/Debug folder, why it is the below path was not access instead. How could I check to validate the actual path where the application finding the DB.

C:\Users\JV\Desktop\FeedBackSystem\FBSystems\KPI.a ccdb

Cancer69 is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Way to detect when ADODB.Connection has lost its connection? mdlueck Modules & VBA 7 10-26-2012 07:00 AM
SQL server with CRM Dynamics 4.0 tinyevil777 SQL Server 0 03-03-2011 05:41 AM
Question How to create odbc connection thru ms access code to connect access to sql tables marianne General 3 03-27-2009 05:25 PM
How to Establish the connection between Ms-Access2000 & Oracle using DAO Connection? gksenthilkumar General 1 09-26-2005 08:51 PM
Help with Access to Outlook connection woknick General 1 12-21-2004 12:42 AM




All times are GMT -8. The time now is 11:07 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World