oddz
asked on
visual basic connect to access database
i am trying to connect an Access database with Visual Basic 6.0 using DAO.
my codes goes like this:
Const CONNECT$ = "ODBC;uid=;pwd=;driver={Mi crosoft Access Driver (*.mdb)};database=;dsn=myD B;"
Public wrkMaster As Workspace
Public cnnMaster As Connection
Set wrkMaster = DBEngine.CreateWorkspace(" ", "", "", dbUseODBC)
Set cnnMaster = wrkMaster.OpenConnection(" myDB", dbDriverNoPrompt, False, CONNECT$)
whenever i try to run these codes, VB gives me the error 3059 - "Operation cancelled by user"
is there anything wrong with the codes or ODBC setting??
my codes goes like this:
Const CONNECT$ = "ODBC;uid=;pwd=;driver={Mi
Public wrkMaster As Workspace
Public cnnMaster As Connection
Set wrkMaster = DBEngine.CreateWorkspace("
Set cnnMaster = wrkMaster.OpenConnection("
whenever i try to run these codes, VB gives me the error 3059 - "Operation cancelled by user"
is there anything wrong with the codes or ODBC setting??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Const CONNECT$ = "ODBC;uid=;pwd=;driver=""M
' A pair of double quotes in a row is coverted into a single double-quote in the
string. "Hello ""Joe"" my friend!" becomes: Hello "Joe" my friend!
Public wrkMaster As Workspace
Public cnnMaster As Connection
Set wrkMaster = DBEngine.CreateWorkspace("
Set cnnMaster = wrkMaster.OpenConnection("
Or:
Const CONNECT$ = "ODBC;uid=;pwd=;driver=""{
Public wrkMaster As Workspace
Public cnnMaster As Connection
Set wrkMaster = DBEngine.CreateWorkspace("
Set cnnMaster = wrkMaster.OpenConnection("
Brian