473,395 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Connect MS Access with Visual Basic 6.0

30
how do i make it that when i move the files to another directory but still on one folder i will not have to edit the app path of the ms access?

when i created a table and connected it to my adodc..
and when i moved the files to another directory it still searches for the table in the original directory that i indicated beforehand
thanks
Mar 12 '08 #1
3 1315
VBWheaties
145 100+
how do i make it that when i move the files to another directory but still on one folder i will not have to edit the app path of the ms access?

when i created a table and connected it to my adodc..
and when i moved the files to another directory it still searches for the table in the original directory that i indicated beforehand
thanks
you can always pass in the path to your application or create a textbox in your app for the location or even prompt the user for the location if it cannot be found. many choices available to you.
Mar 12 '08 #2
conics
30
you can always pass in the path to your application or create a textbox in your app for the location or even prompt the user for the location if it cannot be found. many choices available to you.
can you tell me how?

im new at database making
Mar 13 '08 #3
VBWheaties
145 100+
can you tell me how?

im new at database making
I suggest using parameters since they are the easiest explain.

When a parameter is passed in, it gets set to the global "Command" object which is nothing more than a string.

For example, lets say my application is called MyApp.exe and I need to send in the location of my database. This will be the call to open my program with a commandline parameter:

C:\Program Files\VBWheaties\Myapp.exe "C:\Program Files\MyDatabase\MyData.mdb"

As you can see MyApp.exe is being called with the commandline parameter of a database path (C:\Program Files\MyDatabase\MyData.mdb)

In your code, to get access to this commandline parameter:

Expand|Select|Wrap|Line Numbers
  1. Public Sub OnFormLoad()    'on form load or whatever sub you want to make
  2.    Dim DatabasePath As String   
  3.    DataBasePath = Command()  'Command() will give us the parameter 
  4.    'Then continue to load your app as normal. 
  5. End Sub 
  6.  
As you can see, Command will have the database path because I passed it in when I launched the exe at the command line (Start>Run)

More traditionally, you can use shortcuts to pass in commandline parameters.
You want to make a shortcut for your executable. Let me know if you dont know how to do this.
In the shortcut, and on the Shortcut tab, you'll see the location of your exe.
After the quote surrounding the path to your exe (if there is one), put a space, then type in your parameter. Put it in quotes. Save the shortcut.

When you double-click this shortcut, it will pass the value typed in. This is the commandline parameter that your application will use. Its pretty powerful stuff: you can pass in any string value you choose and your app can use that to do something custom, like change the path to your database file.
Mar 13 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Linda Lee | last post by:
I purchased Visual Basic .NET version 2003 Standard I first try to connect Visual Basic .NET 2003 Standard to SQL Server 2000 Personal edition. When I go into Visual Basic .NET under Server...
1
by: Zvonko Tusek | last post by:
Is there a way to use access database on web host (I have a web hosting account) in visual basic. I want to make Visual basic client applications that connect to internet and work with access...
5
by: mayamorning123 | last post by:
A comparison among six VSS remote tools including SourceOffSite , SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET To view the full article, please visit...
1
by: Dave | last post by:
I am trying to learn .NET with the standard edition of VC++.NET 2003 Standard edition. When I use the wizard in the toolbox to connect to a non-microsoft ODBC data source, I get the error message...
1
by: http://www.visual-basic-data-mining.net/forum | last post by:
Hi, I am new here. I am facing a problem that I can't connect to MS Access with my Web application written in VB.Net. It gives me this kind of error: The Microsoft Jet database engine cannot...
2
by: http://www.visual-basic-data-mining.net/forum | last post by:
Say i have declare a module for connection and two buttons... one button has the method connect() and the other has the method disconnect().... how do i actually connect after i had disconnect...
3
by: kumarg | last post by:
how to create database in Ms-Access & how to connect that database with Visual Basic-6.0? Kindly let me know in detail.
2
by: czi02 | last post by:
does anybody knows how to connect access to visual basic?? I know that this is for access and database but hope that there is someone who could help me just a simple code on how to connect easch...
4
by: chowdhury | last post by:
Hi, I am new in visual basic. i want to know how to connect and access data to MS Access or MS SQL database from a visual basic form.plz write me the code. Regards, chowdhury
2
by: sandipdeshmukh | last post by:
how to connect both MS Access and MS SQL database in one visual basic form
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.