Solved

Close an ODBC Connection

Posted on 1998-07-02
2
135 Views
Last Modified: 2010-05-03
I have a data control with the RecordsetType set to SNAPSHOT, and the connect properties set to the proper values and I set the Data.Recordsource = "select name from customers order by name".  A MsFlexGrid is populated with the result of the query.  I just want to CLOSE the ODBC connection since the application does not need to connect to that database again, ho do I close that connection ?
0
Comment
Question by:aleporter
2 Comments
 
LVL 3

Accepted Solution

by:
AndreasSchindler earned 100 total points
ID: 1464881
Data.recordsource=""
data.refresh
for a Control

dim sn as Recordset
set sn=...
.
Set sn=nothing
for DAO Access

0
 

Author Comment

by:aleporter
ID: 1464882
Your answer is good for a certain type of situation, but in my case I only have this code, how could I close the connection to the database without exiting the application ?
(I have two msflexgrid controls in the form, grid2 populates with data1.recordsource and grid1 populates when the command1 button is clicked)

Private Sub Form_Load()
    Dim sql1 As String
    sql1 = "SELECT nro_prestador, nombre from prestadores order by nombre"
    Data1.RecordSource = sql1
End Sub

Private Sub Command1_Click()
    For i = 1 To Grid2.Rows - 1 Step 1
        Grid2.Row = i
        Grid2.Col = 0
        aux = Grid2.Text
        Grid2.Row = i
        Grid2.Col = 1
        auy = xGrid2.Text
        Grid1.AddItem aux & Chr(9) & auy
    Next i
End Sub
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

792 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