How can I convert VBA code to VBScript? Any Internet wizards to do this?




Myra


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!


Answer
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.

I get the following error everytime I boot up: Microsoft VBScript runtime error. How can I fix this problem?




rpateras


It doesn't seem to affect anything I do on the computer, but it's really annoyimg and I don't understand the comments on the MS support web page.


Answer
What exactly does the error say? Does it mention a file causing this error? Do you get the error booting into Safe Mode? You evidentally have a startup item that is causing a problem. More info on the error message could really help find the culprit.




Powered by Yahoo! Answers

Comments :

0 komentar to “How can I convert VBA code to VBScript? Any Internet wizards to do this?”
 

Sexy Lace Bikini

Leave little to the imagination in this super sexy booty short bikini transparent lace. Adjustable triangle top with peek-a-boo slits ties at neck and back. Matching ruffled booty shorts leave so little to the imagination! 90% Nylon 10% Spandex. Four way stretch means one size fits most. Unlined. Club Wear by Body Zone Read More

LG Scarlet

This event, which was attended by more than 200 media from Middle East and Africa, followed earlier events in Los Angeles and in London that drew celebrities for a mock premiere event to reveal the secret of “Scarlet, The Hit New TV Series,” which had been promoted through broadcast and online trailers.