Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vbscript and Microsoft Access

Status
Not open for further replies.

bdragun

MIS
Jan 28, 2003
30
US
I have a couple scripts that help our help desk person out. One in particullay helps reset domain passwords. What I would like to happen is after it resets the password to log it to an access database. I would like the date/time, and username that it unlocked to be logged as of right now. Anyone know how to do this? Are there any sites that have info on how to do this? I am looking right now but haven't found anything yet.

Thanks
 
Microsoft just did a webcast last week on scripting with Databases for system administrators. Check out this link:

It has some good example scripts for both reading from and writing to a DB. If you have time watch the webcast last about 1hour 20min.

HTH,

Z
 
There is a short writeup as a Word document and a downloadable Zip file example at:


Scroll down to "Database Interaction Without a Web Server."

This talks about writing local web pages with VBScript in them to create, update, and read data from an Access database (MDB file). The zipped sample files cover some really basic ADO to use for such an application, and most of the VBScript can be cut and pasted out of the HTM files into a file to make a WSH script or an HTA.

You may also want to see:


and


The last link is the first in a series of 3 articles. The page at the last link here contains links at the end to the two other articles in the series. Each article also has a link near the very start for downloading the article content. The very first link I gave you should get you started though.

Most of what you will find on ADO (ActiveX Data Objects) in VBScript will be for ASP pages. Most of the concepts apply equally to a desktop script however, except for the issues of connection pooling and the related strategy of closing database connections as soon as possible in ASP. In a desktop script your goal is different: you want to open just one connection if you can, and keep it open for the life of the script in most cases. You probably won't need to worry about this part too much for your purpose here.

There is also a lot of information out there on using ADO with VB6. A good deal of this is useful to a VBSCript developer as well. There is a lot of VB6 sample code out there. Just be sure you understand the limitations of VBScript as compared with VB6. The biggest ones are: no typed variables in VBScript (only Variants), no early binding to objects (can't use Dim x As New ADODB.RecordSet, you only can use Set x = CreateObject(...) syntax).

Another big issue is that there are limitations to setting references in a VBScript, where VB6 has a convenient mechanism for this. This means in VBScript you often need to use large lists of Consts with ADO, because ADO uses a large number of special values or constants. A WSH script written as a .WSF file instead of a .VBS file offers a way around this, but why go into all of that right now?

Hope this gets you on your way.
 
Thanks everyone this is really helpful info I am already logging the info in a database. Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top