Access DB Fields from VB Script within OnPrintStart Event フォローする
Hi!
I am trying to use a .btw file which has VB Script code within the OnPrintStart Event.
This worked fine in Bartender 10.0, but doesn't in Bartender 2019 R5.
The script looks like this:
if Field("GetBartenderQueue.ID") = 2 or Field("GetBartenderQueue.ID") = 3 then
Value=""
else
Value=Field("GetBartenderQueue.STK-Verpackung") / Field("GetBartenderQueue.VPE-Inhalt")
end if
GetBartenderQueue is a Query in an Access-Database, which is configured within the .btw file.
Bartender 2019 claims, that Field("GetBartenderQueue.ID") cant be found and that I should use ReferenceField at the beginning of the script. When I do this, this error still appears.
When I replace the Field(...) with ReferenceField(...) like
if ReferenceField("GetBartenderQueue.ID") = 2 or ReferenceField("GetBartenderQueue.ID") = 3 thenValue=""
else
Value=RefrenceField("GetBartenderQueue.STK-Verpackung") / RefrenceField("GetBartenderQueue.VPE-Inhalt")
end
an Overflow error appears.
I tried many different combinations now but none work. I truly dont understand what is going on and also the fact,
that Backward-compatibility doesn't seem a big Issue with Bartender (like also not supporting the the /w comamnd line switch anymore ...) is quite annoying.
How do I have to do this ? Maybe OnPrintStart was the right place in Bartender 10.0 but isn't in Barzender 2019 ?
Any hints are geratly appreciated!
Regards,
Hans
3 コメント

Pete Thane
I think it would need to be OnNewRecord as OnPrintStart the lookup to the database will not have been performed.
Have you re-linked all the fields in the command lines? Not sure if makes a difference but in 10.0 BT would use the ODBC driver but in 2019 it uses the inbuilt database link.
Hi!
Thanx for replying!
I changed to OnNewRecord but the problem remained.
I have an Access Database connected to my .btw file and Bartender 2019 claimed, that I have to confgure a named Database Connection.
After I diid this, the error messages have vanished, but no it seems, that the VB Scripts are not executed and also the referenced Database fields in Text-objects are not updated anymore with the actual values ?
This is pretty confusing an annoying ...
Regards,
Hans
On screen the information wont show but when you print/print preview and have selected a record then it should. The only exception to this is if you are using a Preview of Template on a Data Entry Form as the VB work does not get processed until after the image is displayed. if that makes sense.
サインインしてコメントを残してください。