Thursday, August 19, 2010

Microsoft access help?

Hello





I want to develop a programme using Microsoft Access .





I have a matrix with the prices for different intervals like 1-10 meter 15$,11-20 meter 14.85$,21-30 meter 14.75$,31-40 meter 14.60$ etc.. such a list of 100 different prices and intervals





And what I want is for example when I want 19 meter , program will know that 19 is between 11-20 meter and will take 14.85$ price and will multiply it with 19*14,85.





I couldn’t use the “if loop” because you can only use it 7 or 8 times what I need is at least 100 loop.





Does anybody know how I can do it in a easy way with Microsoft Access?





Thanks in advance

Microsoft access help?
I would arrange the data in three columns (4 if you have a primary key)





key    lowerL    upperL    Price


1           1         10         $15.00


2          11        20          $14.8...


3          21        30          $14.7...





Then you can use DLookUp





On the form named frmCost, where you enter the length, line up a textbox named txtLength a command button named cmdCost, a textbox named txtPrice, and finally a text box named txtPrice





Create a macro, saved as mcrCost:





Action: SetValue


Item: txtPrice


Expression: =DLookUp("[Price]","tblPrice",


"((forms![frmCost]![txtLength] %26gt; [lowerL])


and (forms![frmCost]![txtLength] %26lt; [upperL]))")





Assign the mcrCost to the cmdCost's On Click event





To the control Sourec property of txtCost, type in





=[txtPrice]*[txtLength]





save and test
Reply:it's early so pay no attention to my answer.... lol





if your intervals are 10 like in your examples





int priceInterval; //truncate the decimal portion





priceInterval = (meters/10) + 1; // if meters is 1-9 it would return something like 0 + 1 or 1 ...


if meters was 990 - 999 it would return 99 + 1 or 100..??





select price from prices where interval = priceInterval





prices


interval 1 price 15


interval 2 price 14.85


etc..





hell i don't know maybe someone that knows programming can help








good luck


No comments:

Post a Comment