p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access (http://p2p.wrox.com/forumdisplay.php?f=18)
-   -   Thanks (http://p2p.wrox.com/showthread.php?t=38727)

95_rifleman February 20th, 2006 07:19 AM

Thanks
 
I'd like to thank mmcdonal for all the assistance in cracking my problems. Many thanks.

However, one other question. How do you create a method to look up the next largest value in a row. For instance; my table is laid out as such.

Width Height Cost
1200 1200 350.00
1250 1200 355.00
1300 1200 370.00
1200 1250 360.00
1250 1250 400.00
etc

If someone entered a value of 1210 for the width, what process would allow the calculation to go to the next highest value? The form has two text boxes, one for the width and one for the height.

Cheers
Chris:)


kindler February 20th, 2006 11:32 AM

I believe it would be something like:

SELECT TOP 1 *
FROM tbl
WHERE tbl.Width >= Forms![frmForm]![fldWidth]
ORDER BY tbl.Width


95_rifleman February 20th, 2006 12:48 PM

Thank you, will try this over the next few days.[8D]


95_rifleman February 23rd, 2006 08:35 AM

Hi Kindler

I've tried this, but it did not work? Any other ideas?

Thanks alot
Chris


kindler February 23rd, 2006 12:53 PM

It should work, can you describe what is happening when you try it and how you're implementing the query (design view, VBA, etc.)?


SerranoG February 28th, 2006 08:57 AM

If you're talking about a form that is based on that table, and if you have a textbox that the person types in the number 1210, then on its After Update event you can put something like

Dim intWidth as Integer

intWidth = DLookUp("[Width]", "CostTable", "[Width] >= " & Me.txtWidth)

This will pull out the first width that is equal or greater than the width you entered into the textbox. Replace "CostTable" with real name of your table. I called the textbox txtWidth.

From there you can get the height and cost using the DLookUp function again.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division

95_rifleman March 6th, 2006 12:54 PM

Hi Greg,

This is great, it works perfectly. I've been able to generate all my data. So thanks very much. Your help is certainly most greatly appreciated.

Chris



All times are GMT -4. The time now is 12:23 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.