Mitsules, Mark
Mark.Mitsules at ngc.com
Mon Jun 2 14:23:27 CDT 2003
Thanks Drew, I had just found an example of the FormName.SelectName.Value syntax on pscode.com and implemented it (it worked), however the example did not include the "document" part. Would this part only be necessary if I was passing values between frames? ...and to address your FYI, yes, this is for a corporate intranet with ~98% using IE and ~93% using IE 6.0. Thanks again, Mark -----Original Message----- From: Drew Wutka [mailto:DWUTKA at marlow.com] Sent: Monday, June 02, 2003 3:09 PM To: 'accessd at databaseadvisors.com' Subject: RE: [AccessD] OT: Passing Variables - VBScript <Script language="VBScript"> Function DoSomething() msgbox document.MyFormName.SelectPrinter.value End Function </Script> Then put DoSomething() in place of the ???What goes here??? spot.(Keep the double quotes around it.) Just an FYI, using VBScript is going to limit your clients to using IE in most cases. I personally use a lot of VBScript on our Intranet, because all Intranet clients use IE. Drew -----Original Message----- From: Mitsules, Mark [mailto:Mark.Mitsules at ngc.com] Sent: Monday, June 02, 2003 11:55 AM To: 'AccessD' Subject: [AccessD] OT: Passing Variables - VBScript Group, This is my first real attempt at developing an HTML application (.HTA) using VB Script. Given that the user makes a selection from this element: <form> <select name="SelectPrinter" onChange="???What goes here???"> <option value="Not Selected" selected> Please select a printer. </option> <option value="\\ServerName\PrinterName1"> Printer #1 </option> <option value="\\ServerName\PrinterName2"> Printer #2 </option> </select> </form> ...?how do I pass their selection to a button element, <INPUT TYPE="Button" NAME="Button001" VALUE="Install"> ...that will utilize a routine like: Sub Button001_OnClick() End Sub I provided an example below that uses separate buttons (with an associated separate function) for each printer (...which works), but this approach is not very elegant. TIA, Mark Function InstallPrinter(PrinterPath) Set WshNetwork = CreateObject("WScript.Network") WshNetwork.AddWindowsPrinterConnection PrinterPath End Function Function SetDefaultPrinter(PrinterPath) Set WshNetwork = CreateObject("WScript.Network") WshNetwork.SetDefaultPrinter PrinterPath End Function Function Button001_OnClick() PrinterPath = "\\ServerName\PrinterName1" InstallPrinter(PrinterPath) End Function Function Button001A_OnClick() PrinterPath = "\\ServerName\PrinterName1" InstallPrinter(PrinterPath) SetDefaultPrinter(PrinterPath) End Function <FORM NAME="Form001"> <INPUT TYPE="Button" NAME="Button001" VALUE="Install Printer"> </FORM> <FORM NAME="Form001A"> <INPUT TYPE="Button" NAME="Button001A" VALUE="Set as Default Printer"> </FORM> _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com