0
Thanks

A few words of thanks would be greatly appreciated.

Connecting VB to Database



Issue



I am unable to connect my VB code to access tables from ms access database.
Please help me to go through.

Solution


If you are using MS Access 97 then use ADODC connection..
  • Drag this from tool box
  • Right click and do the connection then test your connection.


If it is done then go to ur module code and write there code as:


Set cn = New Connection  
cn.ConnectionString = "provider=Microsoft.Jet.OLEDB.3.51;data source=" & App.Path & "name of database.mdb;"  
cn.Open  
n if using 2003 then  
Set cn = New Connection  
cn.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=" & App.Path & "name of database .mdb;"  
cn.Open

Note


Thanks to prad for this tip on the forum.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled "Connecting VB to Database," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).

0 Comments