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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OPENRECORDSET mysterious

Status
Not open for further replies.

yorom

Programmer
Sep 17, 2002
7
FR
hi
years ago i made a program using openrecordset etc... on VB5 and i got no problem.
now i'm using VB6 and there's no way to use OPENRECORDSET without lots of errors
Last one : incompatible type
please help before i'm crazy (should i open a data object before, or create a workspace or... ?)

here's my code:

Dim rstT1 As Recordset
Dim db As Database
Dim strCriteria As String

Set db = OpenDatabase("bd1.mdb")
strCriteria = "SELECT * FROM snack"
Set rstT1 = dbs.OpenRecordset(strCriteria)

thanks a lot for your help
rom the french programmer in danger
 
Hi,
First make sure that you have set references to the appropriate libraries ( DAO 3.6 or MS ADO ).

Check if you have made a typo. Your post decalres db to be of type database and you have used dbs.OpenRecordset in a statement. Check it.

Ensure that the path to the database is complete. If it exists in the same folder as your application try using,
Set db=OpenDatabase(App.Path + "\bd1.mdb")

Else use something like ("C:\Personal\bd1.mdb") Hope it helps. Let me know what happens.
With regards,
PGK
 

1. Either remove references to any ADO data Objects, or define the variable objects completely (this isn't the problem, but want to start off right):
Dim rstT1 As DAO.Recordset
Dim db As DAO.Database

2. MAke sure you are using the right DAO library. The error may be because you are trying to access a '95, '97 or '2000 Jet MDB with the wrong library.

If it is a '2000, then use DAO 3.6.
If it is a '97, then use DAO 3.51, OR DAO 3.6 setting the Type to 4. [/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
thanks guys !

i just put Dim... dao.database and dao.recordset (instead of database and recordset) and it works well
i lose one day but now it's ok

thanks again
bye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top