Join
the community
Sign-up
Ask a question Report

Linking Access 2007 to VB 2008 express [Solved]

enillrae - Latest answer on May 16, 2010 01:20AM
Hello,
I am trying to link my access 2007 database to my visual basic 2008 express edition. however I don't seem to be able to do it and the tutorials online are quite different from what I'm seeing on my screen.
Read more 
3 answers
Answer
+12
moins plus
Not sure if this is what you're looking for, but this is the code I recently used in VB2008 to write a record to an Access 2007 .accdb file without binding elements to a form. It works well and will even save the record if the file is already open.
_____________________

Public Sub UpdateRecord()

'Location of the database (This one is saved in the bin/debug folder)

Dim dbPath As String = "File name here"

'Connection string, you must use this provider for Access 2007

Dim connStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;" _
& "Data Source=" & dbPath & "; Persist Security Info = False;"

'The following Using statement forms a connection to the database; all variables within the Using block have local scope

Using connection As New OleDb.OleDbConnection(connStr)

Dim cmd As New OleDb.OleDbCommand
Dim trans As OleDb.OleDbTransaction '

connection.Open() 'Open connection to database

cmd.Connection = connection

trans = connection.BeginTransaction(IsolationLevel.ReadCommitted)

cmd.Transaction = trans

cmd.CommandText = "SQL Statement Here"

cmd.ExecuteNonQuery() 'Execute command
trans.Commit() 'Save record

'Exit Using block, automatically closing connection to database

End Using
End Sub
Add comment
Answer
+4
moins plus
Below is the link about how to link Access 2007 using VB 2008 Express. The tutorial is for beginner level, showing how to make a connection using wizard.

http://free-tutorial.webs.com/...
Add comment
This document entitled « Linking Access 2007 to VB 2008 express » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.

Not a member yet?

sign-up, it takes less than a minute and it's free!

Members get more answers than anonymous users.

Being a member gives you detailed monitoring of your requests.

Being a member gives you additional options.

Receive our newsletter

health.kioskea.net