Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 20th, 2006, 07:19 AM
Registered User
 
Join Date: Feb 2006
Location: Cambridge, , United Kingdom.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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:)

  #2 (permalink)  
Old February 20th, 2006, 11:32 AM
Friend of Wrox
 
Join Date: Dec 2005
Location: , , .
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I believe it would be something like:

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

  #3 (permalink)  
Old February 20th, 2006, 12:48 PM
Registered User
 
Join Date: Feb 2006
Location: Cambridge, , United Kingdom.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, will try this over the next few days.

  #4 (permalink)  
Old February 23rd, 2006, 08:35 AM
Registered User
 
Join Date: Feb 2006
Location: Cambridge, , United Kingdom.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Kindler

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

Thanks alot
Chris

  #5 (permalink)  
Old February 23rd, 2006, 12:53 PM
Friend of Wrox
 
Join Date: Dec 2005
Location: , , .
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #6 (permalink)  
Old February 28th, 2006, 08:57 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

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
  #7 (permalink)  
Old March 6th, 2006, 12:54 PM
Registered User
 
Join Date: Feb 2006
Location: Cambridge, , United Kingdom.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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







Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.