Solved

Disconnecting Data and DBGrid

Posted on 2001-08-14
7
163 Views
Last Modified: 2010-05-02
I have a data control and a dbgrid that is associated with it. It pulls data from an Access Database and shows selected records in the dbgrid. This is fine. However i allow users to delete the database and create a new one. I am having problems deleting the database. I get Path/File access error when i try to run this command Kill App.Path & "\Apt.mdb" . I know it is becuase the database is connected to the data control but i do not know how to disconnect the database so i can delete it without having to close the whole application. Any ideas?
0
Comment
Question by:Maxim10553
7 Comments
 
LVL 3

Expert Comment

by:Diveblue
ID: 6385870
data1.databasename = ""
0
 
LVL 3

Author Comment

by:Maxim10553
ID: 6385875
tried that already
0
 
LVL 12

Expert Comment

by:roverm
ID: 6385890
This will work:

    Set DataGrid1.DataSource = Nothing
    DataEnvironment1.Connection1.Close
    Kill "C:\Program Files\Microsoft Visual Studio\VB98\Copy of NWIND.MDB"

D'Mzzl!
RoverM
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 9

Accepted Solution

by:
Valliappan AN earned 50 total points
ID: 6386949
roverm, the qn. is for DBGrid.

Maxim10553,
Try using the dbgrid/data control on a different form, and once you unload the form, it will be automatically disconnected.

0
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6387010
Adding to DiveBlue's comments, you need to do a Refresh after setting DatabaseName to "".

Hi, look at this link (look for databasename):
http://www.mail-archive.com/beginning_vb@p2p.wrox.com/msg01425.html

So, it could be:

Data1.DatabaseName = ""
Data1.Refresh

(But still the controls bound to it, will show data, which will disappear once a connection made to data control, as per the above link).

Hope this helps.
0
 
LVL 12

Expert Comment

by:roverm
ID: 6387101
valli_an:
<LOL> You're right !!!
I guess I had my eyes closed when I (tried to) read the question ;-)

D'Mzzl!
RoverM
0
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6387168
roverm, :>
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now