Syntax Error Code 800A03EA - Less Than / Greater Than Symbols (<>) (1 Viewer)

Cark

Registered User.
Local time
Today, 02:33
Joined
Dec 13, 2016
Messages
153
I have a piece of code that is giving me the attached error message when I try running the VBScript Script File. This code worked perfectly when it was in my Access Database, but I am trying to learn about .vbs files so tried to replicate it in Notepad and VBS. I think I have traced it to the <> characters in the code, but I cannot think how to resolve it.

The Error I have been getting is:

Line: 5
Char: 15
Error: Syntax error
Code: 800A03EA
Source: Microsoft VBScript compilation error

Code:
Option_Compare_Database
Private_Sub_Command0_Click()
Dim_accessApp_As_Object
Set_accessApp=GetObject("C:\Users\ME\Desktop\Automated_Database_Upload_Project\Automated_Upload_Database.accdb")
If_Err.Number_<>_0_Then
____Set_accessApp_=_CreateObject("Access.Application")
____accessApp.OpenCurrentDatabase_"C:\Users\ME\Desktop\Automated_Database_Upload_Project\Automated_Upload_Database.accdb",_False
____accessApp.Visible_=_True
____accessApp.UserControl_=_True
End_If

accessApp.Run_("UpdateTheDatabase")

End_Sub
 

Attachments

  • Capture.PNG
    Capture.PNG
    5.6 KB · Views: 110

vba_php

Forum Troll
Local time
Today, 04:33
Joined
Oct 6, 2019
Messages
2,884
according to microsoft, the error it not the <> operators:

http://windowsbulletin.com/how-to-fix-microsoft-vbscript-compilation-and-javascript-error-800a03ea/

i got that from here:

https://www.google.com/search?q=800A03EA+Microsoft+VBScript+compilation+error

but why use VBS when you can simply do this in access anyway?

in terms of LINE 5, that would be this code I'm guessing:
Code:
____Set_accessApp_=_CreateObject("Access.Application")
why are there "_" underscore markups on both sides of the "=" operator? try:
Code:
____Set_accessApp = CreateObject("Access.Application")
 

Cark

Registered User.
Local time
Today, 02:33
Joined
Dec 13, 2016
Messages
153
Hi vba_php,

I am just trying to learn as much as I can as I am very much an amateur at Access & VBA.

From playing around trying to fix the error, I am able to change the error code "Char" term by adding in additional _ just after the Err.Number for example

Code:
If_Err.Number_<

Changes it to show Char 15 but when I remove the _ after Err.Number it says Char 14.

Also with regards to the _ on either side of the = sign, I was getting errors when I used " " instead of "_".
 

vba_php

Forum Troll
Local time
Today, 04:33
Joined
Oct 6, 2019
Messages
2,884
I'm not sure i'm following what you're saying, but what I can do if you want, is replicate it on my end and see if I can spot the cause of the error. can you upload the .vbs file to either here in a ZIP folder or upload it to a cloud server and give me the sharable link pointer?
 

Cark

Registered User.
Local time
Today, 02:33
Joined
Dec 13, 2016
Messages
153
Thanks for your help Adam, sure attached is the VBScript Script File that I have created and have been editing in Notepad.
 

Attachments

  • UpdateDatabaseScript.zip
    405 bytes · Views: 117

sonic8

AWF VIP
Local time
Today, 10:33
Joined
Oct 27, 2015
Messages
998
Also with regards to the _ on either side of the = sign, I was getting errors when I used " " instead of "_".
What are all those underscores doing in your code in the first place? I suggest you get rid of then.


Does VBS support Option Compare Database? - I don't think so.


Does VBS support the Private access modifier? - Not sure, I'd recommend you double check.
 

vba_php

Forum Troll
Local time
Today, 04:33
Joined
Oct 6, 2019
Messages
2,884
What are all those underscores doing in your code
sonic,

I'm guessing what he did was output VBA code by some method, maybe saving as a VBS file? and windows automatically added the underscores. kind of like the __FILE__ spec in PHP.

clark,

you've got this all wrong my friend. VBS is a windows SCRIPTING language and has absolutely nothing to do with an access VBA module, like sonic kind of said. the CORRECT vba code in an access module would be this (or possibly modified a bit):
Code:
Option_Compare_Database
Private Sub Command0_Click()
Dim accessApp As Object
Set accessApp=GetObject("C:\Users\tkorynek\Desktop\Automated_Database_Upload_Project\Automated_Upload_Database.accdb")
If Err.Number<>0 Then
Set accessApp=CreateObject("Access.Application")
accessApp.OpenCurrentDatabase_"C:\Users\tkorynek\Desktop\Automated_Database_Upload_Project\Automated_Upload_Database.accdb",_False
accessApp.Visible = True
accessApp.UserControl = True
End_If

accessApp.Run ("UpdateTheDatabase")

End_Sub
this:
Code:
If Err.Number<>0
"ERR" is an ACCESS object, not a VBS implementation (i'm guessing). that's why that won't work (again, i'm guessing).

this:
Code:
Option_Compare_Database
is an ACCESS vba specification, which also will not work.

also, this:
Code:
accessApp=GetObject("C:\Users\tkorynek\Desktop\Automated_Database_Upload_Project\Automated_Upload_Database.accdb")
I believe is also an access-specific line of code. I've never used GETOBJECT() but I believe I've seen it used, but never in a VBS script. perhaps you know more than me about that though?

but again, the questions is....why r u doing this in VBS? what's the point of that?
 

vba_php

Forum Troll
Local time
Today, 04:33
Joined
Oct 6, 2019
Messages
2,884
to test, I just tried doing the following:

1) exporting the FORM object in access to a file. it did not put "_" in the code.
2) copied the code via the clipboard from an access form module into a .txt file and saved it as .vbs. this also did not put "_" in the code.

so I'm not sure how you got all those underscores in your vbs code cark.
 

Cark

Registered User.
Local time
Today, 02:33
Joined
Dec 13, 2016
Messages
153
Thanks for the input and help guys - it's really appreciated. Quite a few points to address now so I will try my best:

Regarding the "_" all over my code

I intentionally put the "_" into the code. The reason for doing so was because I believed Windows Script Host was telling me that the script was not working correctly with " ". When I added "_" the errors moved onto other lines so I believed they were fixed.

Regarding the origin of my code and where it came from in Access

I currently have an Access Database which has a Form in it with a Command Button which has an On Click Event Event Procedure with it. When I click this Button, it opens another Access Database called "Automated Upload Database" and then runs a function in that database called "UpdateTheDatabase" which updates a load of records.

My plan is to try and get rid of the first Access Database with the Form and the Command Button and to automate it so that I can use Windows Task Scheduler and a VBS Script to set it up so it automatically runs once a day.

The Raw Code in Access for the first Database Command Button is:

Code:
Option Compare Database

Private Sub Command0_Click()

Dim accessApp As Object

Set accessApp = GetObject("C:\Users\ME\Desktop\Automated Database Upload Project\Automated Upload Database.accdb")
If Err.Number <> 0 Then
    Set accessApp = CreateObject("Access.Application")
    accessApp.OpenCurrentDatabase "C:\Users\ME\Desktop\Automated Database Upload Project\Automated Upload Database.accdb", False
    accessApp.Visible = True
    accessApp.UserControl = True
End If

accessApp.Run ("UpdateTheDatabase")

End Sub
 

vba_php

Forum Troll
Local time
Today, 04:33
Joined
Oct 6, 2019
Messages
2,884
My plan is to try and get rid of the first Access Database with the Form and the Command Button and to automate it so that I can use Windows Task Scheduler and a VBS Script to set it up so it automatically runs once a day.
that's understandable cark, but it's not really necessary IMO. but if that's what you wanna do, look it up:

https://www.google.com/search?q=vbs+open+access+database

surely you will find an answer by searching for it.

and to be clear about the "_" symbols, I don't think they're even relevant in VBS scripts, or even used for that matter. I've never seen them used anyway. but if you got less errors by adding them, I could be wrong. but remember, a lot of times with scripting languages, spotting errors can be impossible because the language will not produce any error messages if there is a mistake in the code. it will just produce no output. I get that crap happening all the time with PHP, although a lot of times PHP will create a log file on the server that provides insight. but not always.
 

Cark

Registered User.
Local time
Today, 02:33
Joined
Dec 13, 2016
Messages
153
I seem to have sorted it so that the script works nicely with the following code:

Code:
dim accessApp
set accessApp = createObject("Access.Application")
accessApp.visible = true

accessApp.UserControl = true

accessApp.OpenCurrentDataBase("C:\Users\tkorynek\Desktop\Automated Database Upload Project\Automated Upload Database.accdb")

accessApp.Run "UpdateTheDatabase"

Now I just need to modify the "UpdateTheDatabase" Public Function so that it closes the Access Application.

I tried using "DoCmd.Quit" in the "UpdateTheDatabase" Public Function, but then it gave me an error with the VB Script because it couldn't fully complete running accessApp.Run "UpdateTheDatabase". Any thoughts?
 

vba_php

Forum Troll
Local time
Today, 04:33
Joined
Oct 6, 2019
Messages
2,884
I seem to have sorted it so that the script works nicely with the following code:

Code:
dim accessApp
set accessApp = createObject("Access.Application")
accessApp.visible = true

accessApp.UserControl = true

accessApp.OpenCurrentDataBase("C:\Users\tkorynek\Desktop\Automated Database Upload Project\Automated Upload Database.accdb")

accessApp.Run "UpdateTheDatabase"

Now I just need to modify the "UpdateTheDatabase" Public Function so that it closes the Access Application.

I tried using "DoCmd.Quit" in the "UpdateTheDatabase" Public Function, but then it gave me an error with the VB Script because it couldn't fully complete running accessApp.Run "UpdateTheDatabase". Any thoughts?

"docmd" stands for "do command" or "document command" i believe. try:
Code:
application.quit
or:
Code:
accessApp.quit
 

Cark

Registered User.
Local time
Today, 02:33
Joined
Dec 13, 2016
Messages
153
The code below has now allowed me to get everything working. Nice one.

Code:
dim accessApp
set accessApp = createObject("Access.Application")
accessApp.visible = true

accessApp.UserControl = true

accessApp.OpenCurrentDataBase("C:\Users\tkorynek\Desktop\Automated Database Upload Project\Automated Upload Database.accdb")

accessApp.Run "UpdateTheDatabase"

accessApp.Quit
set accessApp = nothing
 

vba_php

Forum Troll
Local time
Today, 04:33
Joined
Oct 6, 2019
Messages
2,884
well good for you Cark! good luck to ya.
 

Users who are viewing this thread

Top Bottom