I have never used access before so i havent got a clue how to configure
VB 6.0 codes for VBA.
as weight_given and turkey_weight are actually from a table. (see above posts)
And also this code needs to go down the table and try all the values from the table. The table will only have about 40 entries so it is quite easy to put in a simple code like this.
please help...
Code:
Function find_match()
Dim weight_given As Integer
Dim weighttemp As Integer
weight_given = Val(text1.Text)
Turkey_weight= Val(text2.text)
Do weight_given -Turkey_Weight
result = weightless
weighttemp = weightless \ 1 'to make sure all results are postive else it won't find the closest
weight_given -turkey_weight2
If result > weighttemp Then Loop
If result < weightemp Then weighttemp = result
Loop Until weighttemp = 0 'i will ensure there is a value of 0 at the bottom of tableweight
temp = actual_weight 'needs to be put into the invoice table somehow
End Function