Creating Query Prompt in Custom SQL Statement 追蹤

0
Avatar
Chris Cook

Hi

I use Bartender to print price labels, I have a custom SQL statement to add VAT onto my prices, this stops the option to select a filter and I need to write one in to the statement.

I would like to create a query prompt for the barcode so that I can search for and print by barcode.

I have read and watched as many tutorials as I can find and got to this point with my SQL statement

SELECT p.name, p.code, p.pricesell+(p.pricesell * t.rate) as withTax
FROM products p, taxes t
WHERE p.taxcat = t.category;
WHERE p.code = '?Barcode'

The first 3 lines add the VAT and work on their own, the forth line that I have added to create the query prompt breaks everything, so help please.

Chris

 

4 意見

0
Avatar
Pete Thane
評論操作 永久連結

Couldn't you use VB in the label instead to calculate the VAT and so strip out that part of the custom statement? 

0
Avatar
Chris Cook
評論操作 永久連結

Hi

I would love to but the basic SQL statement was the limit of my knowledge, let alone trying to learn VB.

I have watched and read loads of tutorials but it just doesn't come together in my brain like it used to, I think I will have to find someone with a better grasp of it and throw a bit of money their way to sort it out.

0
Avatar
Pete Thane
評論操作 永久連結

This will show you how it can be done. My dummy label is not linked to a database and so I am using two static fields that I have named but for you a list of the available Database fields will appear in the right hand column and and when you want to reference them type the start of the command (ie "Value =  " and then double click on the field name in the right hand column to add it. 

Coming from a database, I would set the VB to be an Event Controlled Script and OnNewRecord event so that the code is processed each time a new record is selected from the database to print.

I hope this helps

Pete

0
Avatar
Chris Cook
評論操作 永久連結

Thank you so much Pete, really appreciate you taking the time to help me.

I will go away and try this, might take a while with life and work etc. but I will come back with the results to let you know and hopefully help someone else later on.

Regards

Chris

 

登入寫評論。