Solved

Close an ODBC Connection

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

896 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

17 Experts available now in Live!

Get 1:1 Help Now