Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No compatible data source

Status
Not open for further replies.

JimRich

Programmer
Oct 23, 2000
57
US
Although I have been programming since 86 I have never actually programmed in VB6. However, I am teaching a High School class in VB6. I know that is not very good but it is my situation. Here is my problem.

I receive the following message when trying to set up a DBGrid.

No compatible data source was found for this control. Please add an OLEDB data source such as Data environment or MSADO Data control to the Form or project.

I am connecting successfully to a Access 2000 table with a data control object.

I have the following compotents installed: MS Common Dialog Control 6.0 (sp3); MS DataGrid Contorl 6.0 (sp5) (OLEDB).

I am running under Windows 2000 server and VB6 with SP5 installed.

I get the message when I try to enter the Data Source property on the Grid.

JimRich
 
jimRich

hope this helps

DASH


DIM CONN AS STRING


DIM RS2 as ADODB.RECORDSET


SET RS2 = NEW ADODB.RECORDSET


CONN. OPEN "PUT IN YOUR CONNECTION SRING HERE"



SqlGetPrintedOrders = "SELECT * FROM WHEREVER "



With RS2

If RS2.State = 1 Then RS2.Close
.ActiveConnection = CONN
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
.Source = SqlGetPrintedOrders
.Open
End With


Set DGPrinted.DataSource = RS2 ' This sets the datagrid recordsource as rthe ADODB recordset (RS2 in this case)


DGPrinted.Refresh

 
Thanks for your help. I understand the code execpt for the connection string. I am connecting to an Access 2000 database called "slight.mdb" with a table called tblRegistration.

Do I put this code in the DBGrid or in the form load sub?

JimRich
 
Set cn = New ADODB.Connection

With cn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\slight.mdb;Persist Security Info=False"
.Open
End With


 
JimRich,

Put the connection string and the code binding the grid to the data source in the form load sub.
 
JimRIch,

If your usng a DSN (ODBC) you can do somthing like this

conn.open "DSN=MyAccessDsn" if you use a pwd and user id then add:

conn.open "DSN=MyAccessDsn; User ID = itsme; Password=mypassword"

DASH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top