Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear All,
I´m trying to update a field in a SQL table with the data in a QV variable. The problem is to the macro understand the variable (looks simple but I´m new ...). If I fix a value it works.
Bellow is the macro and the variable used is the v_VARCHAR
sub Rec_Data()
dim sServer, sConn, oConn,oRS
sServer="ARPoint-AR\SQL2008"
sConn="Provider=SQLOLEDB.1;Initial Catalog=QV;Data Source=arpoint-AR\sql2008"
Set oConn = CreateObject("ADODB.Connection")
oConn.Open sConn, "sa", "123"
Set oRS =CreateObject("ADODB.Recordset")
sSQL="UPDATE Table_1 SET Col1_Varchar = " + $v_VARCHAR
oRS.Open sSQL, oconn
end sub
Thanks in advance.
Hi,
the macro module doesn't understand dollar sign expansion.
You must use:
sSQL="UPDATE Table_1 SET Col1_Varchar = ' " + ActiveDocument.Variables("v_VARCHAR").GetContent.String + " ' "
Hope this helps
Fernando
try $(v_VARCHAR) or '$(v_VARCHAR)'
Felim,
Both failed. I also tryed it
sSQL="UPDATE Table_1 SET Col1_Varchar = ' " + $(v_VARCHAR) + " ' "
Thanks.
Hi,
the macro module doesn't understand dollar sign expansion.
You must use:
sSQL="UPDATE Table_1 SET Col1_Varchar = ' " + ActiveDocument.Variables("v_VARCHAR").GetContent.String + " ' "
Hope this helps
Fernando
Fernando,
Work fine. Thanks.