Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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:)

Reply With Quote
  #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

Reply With Quote
  #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.

Reply With Quote
  #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

Reply With Quote
  #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.)?

Reply With Quote
  #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
Reply With Quote
  #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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off




All times are GMT -4. The time now is 04:54 AM.


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