Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


staying in VBScript after action= on select/option Onchange

Posted on 2016-10-11
Medium Priority
Last Modified: 2016-10-31
I have an .asp page on which there is a form that has a select/option/value/Action element with the initial values of which are set from a Records/fields from a MSAccess Database.The user will peruse the contents of the select box eventually picking out a record at which point the "action" takes over and calls a function residing in that page's header. The problem is that function will be in JavaScript and therefore not allowing me access to that database – or to any other.

The question is how can I provide the same functionality as the above without ever leaving the ASP code?


Question by:Ross Greenberg
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
LVL 33

Expert Comment

by:Big Monty
ID: 41838282
ASP is not a language, but rather a technology. VBScript is primarily used as the server side language (although you can use javascript) while javascript and html are used client side to build the page. Server side code ALWAYS runs first, and once it does, it will not run again without making another call back to the server (for example, when a form is submitted).

if you want to make a call back to the server without having to reload the page, I recommend having a look at ajax, as it'll do just this:


maybe if you can explain in more detail what you want, or if you have a link to the page that you can share, I can help guide you in a more specific manner.

Author Comment

by:Ross Greenberg
ID: 41838505
look at http://www.nhtf.net/resreg.asp and play with the select thingie in the middle of the screen. Select something and an alert popup shows the line I want to execute against the MSAccess database on the server.
LVL 33

Expert Comment

by:Big Monty
ID: 41838660
shows the line I want to execute against the MSAccess database on the server.

i'm afraid i don't follow. No popup comes up, although i see in your source code you call the MsgBox() function, which is not a valid javascript function, but rather a visual basic function.

depending on your level of experience developing dynamic web pages, you may want to consider EE Gigs
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Author Comment

by:Ross Greenberg
ID: 41838676
Whoops!  I was trying something out.  Try it again?
LVL 33

Expert Comment

by:Big Monty
ID: 41839265
Ok now it's doing an alert statement that does a select based off of the dropdown.

What do you want to do now? Do you want to display data on the page based off of the dropdown? Do you want to save data to the database? If that's the case, start familiarizing yourself with ajax as we'll probably need to utilize it, otherwise   explain in functional terms first, not technical.

Also please provide any source that is relevant.

Author Comment

by:Ross Greenberg
ID: 41839369
Okay. What I want to accomplish is that when the user is scrolling through the choices offered in the select box is to read the MSAccess database to get the appropriate record and to dissect the relevant fields and to display them in the appropriate text fields (add1onscreen.value = recordset.add1.value, etc.) until the 'right' one is found/displayed.

I'm loath to learn Ajax just to solve this particular problem – it certainly does look powerful indeed and it does appear that *really* learning Ajax is going to take more than a couple of hours (any freebie AjaxToolkits you recommend to get started?)

(Does EE have a 'private message' capability?)
LVL 33

Accepted Solution

Big Monty earned 2000 total points (awarded by participants)
ID: 41839380
If you're going to be reading data from the database, you're going to have to go back to the server anyways,  either by ajax or a fotm submit.  That's because once the page has been rendered, all connections to the database are gone.

If you're familiar with jquery, learning ajax is pretty simple. If youre not,  then there is going to be a steep learning curve,  which is why I suggested EE Gigs.  I believe there is private chat on here,  but I believe it costs money. I'll PM you some more info for other options.
LVL 33

Expert Comment

by:Big Monty
ID: 41866594
this is the solution that ended up fixing the issue as I did the work outside of EE for him.

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question