Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

explain below macro code

Hi

Can anyone explain below macro code, i had found it by google.

Pls can you explain, it will helps me a lot.

sub Connection

set conn=CreateObject("ADODB.Connection")
conn.Open "CONQ"
set rs=CreateObject("ADODB.recordset")
risque = getVariable("Change")

set inventory = ActiveDocument.Fields("codeinv").GetPossibleValues

for i = 0 to inventory.Count-1


' Database Update

sql="UPDATE invd3 SET "
sql=sql & "risqueqte='" & risque & "'"
sql=sql & " WHERE codeinv='" & inventory.item(i).Text & "'"

on error resume next
conn.Execute sql
if err <> 0 then
msgbox("No update permissions! " & err )
end if
'End of the Update
Next
conn.close
end sub

function getVariable(varName)
set v = ActiveDocument.Variables(varName)
getVariable = v.GetContent.String
end function


Thanks in advance

1 Reply
danielrozental
Master II
Master II

It updates rows in a database based on a variable content.

Why don't you just post what your problem is instead of googling for unknown code.