English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hello, I need to convert some VBA code to VB script code for the following project. I am using an Access 2003 Database with an HTML webpage and my goal is to pass values to the webpage to display the database "Search Results". The page doesn't have to be published, just run from my local computer. ANY help is appreciated!

2006-08-02 13:14:07 · 1 answers · asked by Myra 4 in Computers & Internet Programming & Design

1 answers

For the most part, it boils down to removing variable types and using late binding.

For example:
Dim daoDBEngine As New DAO.DBEngine
Dim daoDB As DAO.Database
Set daoDB = daoDBEngine.OpenDatabase(MyAccessFile)

becomes:
Dim daoDBEngine
Dim daoDB
Set daoDBEngine = CreateObject("DAO.DBEngine")
Set daoDB = daoDBEngine.OpenDatabase(MyAccessFile)

And:
Dim sVal As String
Dim iVal As Integer

becomes:
Dim sVal
Dim iVal

You'll want to check your variables before using them (at least those that you allow a user to specify--always a good rule, anyway). There's no guarantee that what you think stores a number is actually a number. Functions like IsNull() and IsObject() and IsNumeric() all come in handy.

Many consider it important to use some form of Hungarian notation, so that the name of the variable tells you what data that variable will hold. (Strings begin with "str" or "s", Dates begin with "dt", Integers with "int" or "i", Long values with "lng" or "l"... There are guides out there, or make your own system that fits you well, or just forget about the whole concept. :) )

There are some changes in procedures and syntax, as well, but those are fairly minor. See the link below for more info on which language supports what.

2006-08-02 19:21:22 · answer #1 · answered by Hulett H 2 · 2 1

fedest.com, questions and answers