Discussion Locked

Microsoft Access XP and Visual Basic 6

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have several Microsoft Access XP tables (databases) that I want to use in Microsoft Visual Basic 6.0. How do I do this? Is there a converter/importer for this purpose? I'm a retired (DOS) computer programmer and I'm trying to learn Visual Basic 6.0 or should I be trying to learn Visual Basic.NET if VB.NET has this converter/importer?

Thanks for any help anyone can provide.

2 replies

by miss kitty

You need to update your mdac to the latest version (that's your data access control) and update VB 6.0 to the latest service pack. Below is an example of the code that you can use to open the databases:
Dim objConn As New ADODB.Connection
Dim objCmd As New ADODB.Command
Dim objRS As New ADODB.Recordset
Dim objParam As ADODB.Parameter
Dim count As Integer

'set up the database pointer
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=E:\ACCESS\CONTRACT HAULERS\HAULER.mdb;User ID=ADMIN"
objRS.CursorType = adOpenDynamic
objRS.LockType = adLockOptimistic

'setting the Active Connection for the command object
objCmd.ActiveConnection = objConn

'Providing the query name as commandtext
objCmd.CommandText = "[DELETE TTICKET QUERY]"
objCmd.CommandType = adCmdStoredProc

'Set the recordset to the command object result
Set objRS = objCmd.Execute
We still do alot in a dos environment.

Good Luck
Cathy

by bmacarthur

As a beginning VB programmer, you may want to check out the following sites; they have hundreds of examples showing connectivity between VB and MS products:

http://www.planet-source-code.com/vb
http://www.codeguru.com/vb/
http://www.codeproject.com/
http://www.programmingmsaccess.com/

The following are forums where you can get more specific help:
http://www.access-programmers.co.uk/forums/
http://www.utteraccess.com/
http://www.visualbasicforum.com/

You may also wish to run a query in Google Groups.

This discussion is closed to new replies.