Solved

Close an ODBC Connection

Posted on 1998-07-02
2
132 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

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…
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…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

744 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

11 Experts available now in Live!

Get 1:1 Help Now