Problem with send a MS Access SQL Query with a client side string variable using VBscript. I use the client side to dim my variable, but when I try using this variable in a sql statement in server side code it fails. I have used msgbox on the client side to debug and I see the statement but the variable is blank or if I use "'" "'" around my variable I get 'variable' and no value of the variable. BUT I can use a number 111 and the sql statment works can somebody help me. THIS HAS GONE ON TOO LONG
COPY OF MY CODE
<Script Language="VBscript">
dim conn2
dim rs2
dim sql
dim v_compID
Document.select.T1.value = "222"
v_compID = Document.select.T1.value
<% Set conn2 = Server.CreateObject("ADODB.Connection") %>
<% conn2.Open "DSN=TimeData" %>
<% Set rs2 = Server.CreateObject("ADODB.Recordset") %>
<% Set rs2.ActiveConnection = conn2 %>
<% sql = "SELECT * FROM Companys WHERE Company ='" & v_compID & "'" %>
<% rs2.Open sql, conn2, 0, 4 %>
msgbox " <%= sql %>"
<% Do while NOT rs2.EOF %>
Document.ComboBox2.AddItem("<%= rs2("Cid") %> " & " " & "<%= rs2("Company") %>")
<% rs2.MoveNext %>
<% Loop %>
<% rs2.close %>
<% conn2.close %>
</SCRIPT>
COPY OF MY CODE
<Script Language="VBscript">
dim conn2
dim rs2
dim sql
dim v_compID
Document.select.T1.value = "222"
v_compID = Document.select.T1.value
<% Set conn2 = Server.CreateObject("ADODB.Connection") %>
<% conn2.Open "DSN=TimeData" %>
<% Set rs2 = Server.CreateObject("ADODB.Recordset") %>
<% Set rs2.ActiveConnection = conn2 %>
<% sql = "SELECT * FROM Companys WHERE Company ='" & v_compID & "'" %>
<% rs2.Open sql, conn2, 0, 4 %>
msgbox " <%= sql %>"
<% Do while NOT rs2.EOF %>
Document.ComboBox2.AddItem("<%= rs2("Cid") %> " & " " & "<%= rs2("Company") %>")
<% rs2.MoveNext %>
<% Loop %>
<% rs2.close %>
<% conn2.close %>
</SCRIPT>