"object Required" Error 追蹤

0
Avatar
Legacy Poster

Hello!, I'm barely new on this forum :blink:

I'm doing some tests on VBScripting, I went to "OnPrintJobEnd" event and tried to do my first steps with
this:

[quote]'Connection
Set Connection = CreateObject("ADODB.Connection")
Connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Seagull\BD\BarcodeData.mdb"

'Retrive Code
ReferenceField("BARCODE")
Dim ID
Set ID = Field("BARCODE", "0")

'Try to Update
Connection.Open
Connection.Execute "UPDATE tb_IT_BarcodeListing_DB SET FLAGED=True WHERE BARCODE LIKE '%" & ID & "%';"
Connection.Close
[/quote]

But the Scrip Assistant seems to be unhappy with something on this code because it throws the next error:
[quote]OnPrintJobEnd(Line 8): :Object required: '[string: 0]'[/quote]

I was looking for the object reference manual on the site, but I didn't found it.

Can anyone tell me what could be going wrong with it?

Thnks in advance! Santos.

3 意見

0
Avatar
Ian Cummings
版主
評論操作 永久連結

Isn't "ID" supposed to be a string variable? Therefore, wouldn't just ID = Field("BARCODE", "0") do the trick?
0
Avatar
Legacy Poster
評論操作 永久連結

[quote name='Ian C - Seagull Support' timestamp='1359737851' post='4286']
Isn't "ID" supposed to be a string variable? Therefore, wouldn't just ID = Field("BARCODE", "0") do the trick?
[/quote]

Hello =)
yeah yeah, you're right, it suppose to, I tried delcaring on this way, i.e:
[quote]Dim ID As String
ID = Field("BARCODE", "0")[/quote]

But I got this message instead: [quote]Dim ID As String: Expected end of statement[/quote]

I don't catch the point what the problem is, certainly, it have to be something obvious I'm not seeing.
0
Avatar
Legacy Poster
評論操作 永久連結

OMG <_< I was thinking on VB6 not on VBScript so I changed from "Dim ID As String" to just "Dim ID"
this is embarrassing haha.

Thanks a lot... Santos

登入寫評論。