Discussion Locked

unrecognized database format

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
hi to all... i have a problem using access in vb.. i create a table in access and i save it.. and when i use vb and connect the database there is an error saying "Unrecognized database format".. how should i correct this.. i am using vb6 and office 2000 in windows 2000... pls help.. tnx

4 replies

by miss kitty

The problem is probably how you're trying to access the database. Below is a sample code of how to connect to a table within an Access database and run an Access query.

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

Good Luck
Cathy

by cyberbob

Go to your start menu, then open Control Panel. Look at your data sources by going to control panel, then to administrative tools, open data sources. Examine User dsn, system dsn, and file dsn. Create a connection in User and system by clicking add, and follow to whatever database driver you are using nad select the database file that you created in Access. If you have Visual Basic configured properly it should be able to access the database from the obbc connections.

This discussion is closed to new replies.