tark221
New Member
- Joined
- Apr 11, 2013
- Messages
- 19
Hi All,
I have a HTA file which when the submit button is clicked it runs the below VB script. No matter what I have tried It doesn't like "CUser=objNetwork.UserName". When I change the SQL code to not include the username variable it works fine but I need to capture the current user. Any help would be much appreciated.
I have a HTA file which when the submit button is clicked it runs the below VB script. No matter what I have tried It doesn't like "CUser=objNetwork.UserName". When I change the SQL code to not include the username variable it works fine but I need to capture the current user. Any help would be much appreciated.
Code:
<!--VBA SCRIPT-->******** language="VBScript">
Sub Window_******
window.resizeTo 900,430
Comments_Area.value="Please enter comments here..."
End Sub
Sub Confirmation
Dim sConnect
Dim objCmd
Dim objRS
Dim objNetwork
Set objNetwork = CreateObject("Wscript.Network")
CUser=objNetwork.UserName
Set Question_1 = document.getElementById("Q1")
Set Question_2 = document.getElementById("Q2")
Set Question_3 = document.getElementById("Q3")
Set Question_4 = document.getElementById("Q4")
Set Question_5 = document.getElementById("Q5")
sConnect = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=C:\Users\testa\Desktop\DB_TFT.accdb;Persist Security Info=False"
Set objCmd = CreateObject("ADODB.Command")
objCmd.ActiveConnection = sConnect
objCmd.CommandText = "INSERT INTO TBL_FEEDBACK(Q1,Q2,Q3,Q4,Q5,COMMENTS,CURRENT_USER,DATE_SUBMITTED) VALUES(" & Question_1.VALUE & "," & Question_2.VALUE & "," & Question_3.VALUE & "," & Question_4.VALUE & "," & Question_5.VALUE & ",'" & Comments_Area.value &"','" & CUser &"',#" & Date() &"#);"
Set objRS = CreateObject("ADODB.Recordset")
Set objRS = objCmd.Execute
End Sub
*********>