vba - Connect Excel Sheet to Access DB with Excel UserForm Button Click -



vba - Connect Excel Sheet to Access DB with Excel UserForm Button Click -

i'm trying create excel add-in have userform , button on it. button should connect excel access database info it.

my code this:

thisworkbook.worksheets("yield").range("a:o").value = "" dim ycdbf string ycdbf = thisworkbook.worksheets("yield").range("r1").value thisworkbook.worksheets("yield").listobjects.add(sourcetype:=0, source:=array( _ "oledb;provider=microsoft.ace.oledb.12.0;password="""";user id=admin;data source=" & ycdbf & " ;mode=share de" _ , _ "ny write;extended properties="""";jet oledb:system database="""";jet oledb:registry path="""";jet oledb:database password="""";jet oledb" _ , _ ":engine type=6;jet oledb:database locking mode=0;jet oledb:global partial mass ops=2;jet oledb:global mass transactions=1;jet ol" _ , _ "edb:new database password="""";jet oledb:create scheme database=false;jet oledb:encrypt database=false;jet oledb:don't re-create locale" _ , _ " on compact=false;jet oledb:compact without replica repair=false;jet oledb:sfp=false;jet oledb:support complex data=false;jet ol" _ , _ "edb:bypass userinfo validation=false;jet oledb:limited db caching=false;jet oledb:bypass choicefield validation=false" _ ), destination:=thisworkbook.worksheets("yield").range("$a$1")).querytable .commandtype = xlcmdtable .commandtext = array("yc") .rownumbers = false .filladjacentformulas = false .preserveformatting = true .refreshonfileopen = true .backgroundquery = false .refreshstyle = xlinsertdeletecells .savepassword = false .savedata = true .adjustcolumnwidth = true .refreshperiod = 0 .preservecolumninfo = true .sourcedatafile = " & ycdbf & " .listobject.displayname = "table_yc.accdb" .refresh backgroundquery:=false end

this works perfect on computer, when move file computer excel add-in file , seek rebuild connection, gives me error.

my office 2013, on other computer version of excel 2010.

does know problem ? reply appreciated.

please check if able connect database on other machine.

also, in code, have included

.refresh backgroundquery:=false

within statement. should not this, check below case url :

vba excel querytables.add .refresh backgroundquery error

excel vba excel-vba ms-access-2010 ms-access-2013

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -