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

access 2000 for vb 6.0 1

Status
Not open for further replies.

masb

Programmer
Sep 9, 2002
5
0
0
LK


please tell me, How can I used access 2000 databse for vb 6.0
When I tried to connect access 2000 data base to vb 6.0 it display a error "invalid database format".
 
Use ADO version 2.6 or higher. If you don't have that it is because you have an old version of MDAC. You can download the newest version of MDAC from
If you still have problems - post you code. Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 

attn : sunaj (technical user)

Thak you very much for your information. it is correct.
 

attn : sunaj(technical user)

The operating system of My Computer is windows 98. I downloaded mdac 7.2 to my computer. But My problem is still remain. When I call access 2000 database using vb it display a msg " invalid database format". I can ingnor this error by translating access database into prior vertion. But please tell me the way how I read access 2000 database using vb ?
 
Get VB6 service pack 5 from the MS site.

Make sure you are using ADO 2.5+ or DAO 3.6 in your programm.

If you are using a DataControl make sure that the Connect property is set to an Access 2000 database.

If you are using a connection object, make sure you are using Type 5 with the database connection string.

Make sure that the database is not corrupted (compact and repair it first) [/b][/i][/u]*******************************************************[sub]
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!
 
Why not hard code your connection in a module? Try this:
Option Explicit

'We'll have a single connection to service multiple
'commands and recordsets
Public conMyConnect As New ADODB.Connection

'commands
Public cmdCustomers As New ADODB.Command
Public cmdInventory As New ADODB.Command
Public cmdOrders As New ADODB.Command
Public cmdDetail As New ADODB.Command
Public cmdAction As New ADODB.Command
'for our simple report using VB6 DataReport object
Public cmdReport As New ADODB.Command


' We'll create one recordset for each command, but you
' could use the same command for multiple purposes by
' redefining it in code

Public rstCustomers As New ADODB.Recordset
Public rstInventory As New ADODB.Recordset
Public rstOrders As New ADODB.Recordset
Public rstDetail As New ADODB.Recordset
Public rstAction As New ADODB.Recordset
'recordset for the report
Public rstReport As New ADODB.Recordset
'We'll use these in various places to set up
'the connection
Public s1 As String
Public s2 As String
Public s3 As String
Public s4 As String

'Having declared these as public in a code module,
'we can refer to them from anywhere in the application

Public Sub OpenConnection()
'Here, we'll set all the connection properties and
'open the connection
s1 = "Data Source="
s2 = App.Path & "\"
s3 = "AVBDEMO.MDB"
s4 = s1 & s2 & s3
conMyConnect.Mode = adModeShareDenyNone
conMyConnect.CursorLocation = adUseClient
conMyConnect.Provider = "Microsoft.Jet.OLEDB.4.0"
conMyConnect.ConnectionString = s4
conMyConnect.Open
End Sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top