Edd
Posts: 547
|
| Posted: 01/18/2008, 7:50 PM |
|
Mike,
You are going to have to use a bit of javascript to complete the task.
Step 1:
In the HTML view find the listbox and make sure it has an "id", if not add one.
Step 2:
In the calling window create a the following javascript functions in the header:
<script language="JavaScript1.1"><!--
function addToList(aText, aValue) {
var lbObj;
lbObj= document.getElementById("idOfYourListBox");
if (lbObj) {
addOption(lbObj,aText,aValue);
sortOptions(lbObj);
}
}
function deleteOption(object,index) {
object.options[index] = null;
}
function addOption(object,text,value) {
var defaultSelected = false;
var selected = false;
var optionName = new Option(text, value, defaultSelected, selected)
object.options[object.length] = optionName;
object.options[object.length-1].selected = false;
}
function sortOptions(what) {
var copyOption = new Array();
for (var i=0;i<what.options.length;i++)
copyOption = new Array(what.value,what.text);
copyOption.sort();
for (var i=what.options.length-1;i>-1;i--)
what.options[index] = null;
for (var i=0;i<copyOption.length;i++)
addOption(what,copyOption[1],copyOption[0])
}
//--></script>
Step 3:
In the popup window create a "afterinsert" event you will need to add a variation of the following:
Dim NewValue
Dim NewDescription
If NameOfRecordSet.Errors = 0 Then
' As I don't know the structure of your tables I am going to leave you
' to pull back the value of the list box and the description into
' NewValue and NewDescription
unloadPage
' The following line effectively tells the client window to update the parent window
response.write "<script>window.opener.addToList('" & NewDescription & "','" & NewValue & "'); window.close();</script>"
response.end
End If
I cannot guarrantee that the code is error free as I have not debugged it - but it is generally what you need.
Hope it helps
Edd
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |