sql source for a vba userform -


i struggling establish sql connection/source vba listbox userform. have been able import correct sql table excel sheet (from code below) attempts far load same data source listbox have failed. code below given me colleague , adapted our db.

sub sql_vba()  dim sconn string dim oqt querytable dim ssql string  'defining connection string  sconn = "odbc;dsn=risk_db;uid=;pwd=;" sconn = sconn & "wsid=;database=risk_db"  ssql = str_sqltext  set oqt = sheet1.querytables.add(connection:=sconn, destination:=sheet1.range("a1"), sql:=ssql)  oqt .name = "query from" .fieldnames = true '' returns headers of tables need .rownumbers = false .preserveformatting = true .refreshonfileopen = false '' dont want refresh file each time opens .backgroundquery = false .refreshstyle = xlinsertdeletecells .savepassword = false .savedata = true .adjustcolumnwidth = true .refreshperiod = 0 .preservecolumninfo = true .refresh backgroundquery:=true  end  end sub 

has experience loading sql tables data sources userforms?

i think this answer question.

if have more questions, leave comment.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -