Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi!
Is possible input data into a qvd or excel, for example, from a button click?
I need to count how many users clicked in to a button. Maybe a action/macro?
Thanks!
I did it using a macro. Thanks for the help.
sub logdet
dim oConn, rs, UserID, Datetime, v1, v2
'on error resume next
'err.clear
Set oConn = CreateObject("ADODB.Connection")
oConn.Open "provider=sqloledb.1;data source=server;initial catalog=db; User ID=user; Password=password"
set v1 = ActiveDocument.Variables("vUserID")
UserID = v1.GetContent.String
set v2 = ActiveDocument.Variables("vDatetime")
Datetime = v2.GetContent.String
oConn.Execute "INSERT INTO DW.dbo.LOGDET(USUARIO, DATA_ACESSO) VALUES ('"&UserID&"', '"&Datetime&"')"
oConn.Close
'If Err.Number <> 0 Then
'
' msgbox("ERRO: " & Err.Number)
' msgbox("USERID: " & UserID)
' msgbox("DATETIME: " & Datetime)
'
'
'Else
'
' msgbox("All rows are now stored in database")'End message
'
'End if
end sub
can you explain in detail..
If i understand you correctly , you want to insert/update data into qvd file using a button action.
This is not possible. You need to write a macro for doing this
Also check if the below link can help you ...
I did it using a macro. Thanks for the help.
sub logdet
dim oConn, rs, UserID, Datetime, v1, v2
'on error resume next
'err.clear
Set oConn = CreateObject("ADODB.Connection")
oConn.Open "provider=sqloledb.1;data source=server;initial catalog=db; User ID=user; Password=password"
set v1 = ActiveDocument.Variables("vUserID")
UserID = v1.GetContent.String
set v2 = ActiveDocument.Variables("vDatetime")
Datetime = v2.GetContent.String
oConn.Execute "INSERT INTO DW.dbo.LOGDET(USUARIO, DATA_ACESSO) VALUES ('"&UserID&"', '"&Datetime&"')"
oConn.Close
'If Err.Number <> 0 Then
'
' msgbox("ERRO: " & Err.Number)
' msgbox("USERID: " & UserID)
' msgbox("DATETIME: " & Datetime)
'
'
'Else
'
' msgbox("All rows are now stored in database")'End message
'
'End if
end sub