-
Plz help a newbie understand SQL
I´m fairly new to VBA and definitly brand new to SQL. I´ve tried to get some answers on a Swedish forum but no luck there. I´m in urgent need of your assistance.
I have a form where I let the user put in a personel number. This triggers a Excel template to open where the following code gets the table from our database:
[VBA]With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array( _
"OLEDB;Provider=SQLOLEDB.1;Persist Security Info=True;User ID=*************;PWD=************;Data Source=**********;Use Procedure for Prepare=1;Auto" _
, _
" Translate=True;Packet Size=4096;Use Encryption for Data=False;Tag with column collation when possible=F" _
, "alse;Initial Catalog=***********"), Destination:=Range("$A$1")).QueryTable
.CommandType = xlCmdTable
.CommandText = Array("""*************"".""dbo"".""**********$Employee""")
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With[/VBA]
Then I do some filtering in that table.
Now I need to learn how to call the database och get what I need without the downloading of the entire table. I can probably learn the SQL language somewhere else, but I need to understand how to access the database.
Could some kind soul plz explain with simple word to a newbie how this works? This would make my day.
The ID I use is a read only ID. I don´t want to nor should I be able to write to the database.
Regards/Cederbusch
-
Ok, I have now actually solved this. Quite easy when I got the hang of it. But that is in Excel. I would very much like to understand how I present the SQL result in a textbox in Word. Anybody?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules