Multiplying values based on if statements using excel DB fields フォローする

Arthur Desrosiers III

Hello everyone, after doing some searches and trying to figure out the right entry to get my idea to work, i'm stuck.

I have a label that when end users print, a dialog box comes up asking the end user to scan 2 bar codes from a physical source. 

One of these two bar codes, that end users will need to scan, has 3 sets of numbers, lets call it mfg#, order#, and box quantity#. 

I have successfully separated the 3 sets of numbers into individual fields on the bar code document I am creating. However, I'm trying to see with VB Scripting, if I can state, if mfg# equals the same mfg# in a excel document that is in Column A, to take the Column B number that is next to it on the same line in the excel document, and times it against the box quantity# on the label. Then output the equation to a value on the label. I had assumed it would look something like.

If Format.Objects("MFG#").Value = Field("PalletTest.Sheet1$.MFG#") then Format.Objects("Pallet QTY").Value = Format.Objects("Box Qty").Value * Field("PalletTest.Sheet1$.BoxPerPallet#") end if


Or as another example. 

If MFG# is 21100, to match it with the 21100 number in the excel document, and take the number next to the 21100 in the excel doc in the next column over (Lets say 16). Then find the box item quantity of 500 that was scanned in prior and times it by 16. Then output the results (8000) onto the label somewhere. 


I am sure I am not doing something right here. 



1 コメント

Pete Thane
コメントアクション Permalink

Cant you just set up a filter/query in your database connection and use the MFG# as the lookup value ? After that you can get your 16 and multiply it by the scanned part