Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 UpdateNextconn.closeend sub
function getVariable(varName) set v = ActiveDocument.Variables(varName) getVariable = v.GetContent.Stringend function
Thanks in advance
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.