Hi, everyone,
I have a form that is building select boxes using select statements to pull data from my access db.
However, this method is saving the values selected in the box as one whole string, (I have multiple columns).
I simply do not know how to separate the values from the query string using javascript so that I may save them to their proper fields in the database. I am so stuck on this one...any help or suggestions is appreciated...
Function BuildSelectControl(strName, strValue)
BuildSelectControl=""
Set rsTemp = server.CreateObject ("ADODB.Recordset")
strSQL =""
strSize = 1
if "ContactCode" = strName then strSize = 1 : strSQL = "SELECT [ContactCode]+[ContactName], [ContactCode]+[ContactName]FROM [CONTACTS] " end if
if "CustomerCode" = strName then strSize = 1 : strSQL = "SELECT [CustomerCode]+[CustomerName], [CustomerCode]+[CustomerName] FROM [CUSTOMERS] " end if
if strSQL <> "" then
rsTemp.open strSQL, dbConnection
if rsTemp.EOF then exit function
BuildSelectControl = BuildSelectControl & "<select size = " & strSize & " name=""" & strName & """>"
BuildSelectControl = BuildSelectControl & "<option value="""">Please select</option>"
while not rsTemp.Eof
if rsTemp(0)=strValue then
BuildSelectControl = BuildSelectControl & "<option value=""" & rsTemp(0) & """ selected>" & rsTemp(1) & "</option>"
else
BuildSelectControl = BuildSelectControl & "<option value=""" & rsTemp(0) & """>" & rsTemp(1) & "</option>"
end if
rsTemp.MoveNext
wend
BuildSelectControl = BuildSelectControl & "</select>"
rsTemp.Close
set rsTemp = Nothing
I have a form that is building select boxes using select statements to pull data from my access db.
However, this method is saving the values selected in the box as one whole string, (I have multiple columns).
I simply do not know how to separate the values from the query string using javascript so that I may save them to their proper fields in the database. I am so stuck on this one...any help or suggestions is appreciated...
Function BuildSelectControl(strName, strValue)
BuildSelectControl=""
Set rsTemp = server.CreateObject ("ADODB.Recordset")
strSQL =""
strSize = 1
if "ContactCode" = strName then strSize = 1 : strSQL = "SELECT [ContactCode]+[ContactName], [ContactCode]+[ContactName]FROM [CONTACTS] " end if
if "CustomerCode" = strName then strSize = 1 : strSQL = "SELECT [CustomerCode]+[CustomerName], [CustomerCode]+[CustomerName] FROM [CUSTOMERS] " end if
if strSQL <> "" then
rsTemp.open strSQL, dbConnection
if rsTemp.EOF then exit function
BuildSelectControl = BuildSelectControl & "<select size = " & strSize & " name=""" & strName & """>"
BuildSelectControl = BuildSelectControl & "<option value="""">Please select</option>"
while not rsTemp.Eof
if rsTemp(0)=strValue then
BuildSelectControl = BuildSelectControl & "<option value=""" & rsTemp(0) & """ selected>" & rsTemp(1) & "</option>"
else
BuildSelectControl = BuildSelectControl & "<option value=""" & rsTemp(0) & """>" & rsTemp(1) & "</option>"
end if
rsTemp.MoveNext
wend
BuildSelectControl = BuildSelectControl & "</select>"
rsTemp.Close
set rsTemp = Nothing