Senin, 30 Januari 2017

Re: [MS_AccessPros] Comparing price values and writing out a description

 

Lance-


For starters, your prices table isn't normalized.  I assume you price rooms by room category, so your pricing table should look like:

PriceID, RoomCategory, DayOfWeek, Price

Next, you need a function to which you pass parameters of arrival date, departure date, and room category.  Your function can "walk" through the reservation dates, calculate the day of the week, and do a lookup into your pricing table.  To print a generic report for Mon-Sun of any week, you would call the function with the date of any Monday and the date of any following Monday.  That would allow you to use the same function to generate a price list for a specific room or a price list for any week.

I assume you need help writing the function …  😃

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Jan 30, 2017, at 9:12 PM, Lance Gallant istari.6@gmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



Hi everyone

I have a challenge with creating the following price description function to use in a report, which I am having trouble getting my head around.

I have table which contains prices for an item, but the price could be different for each day of the week. This is for accommodation, where the price could differ based on the day of the week/, I have columns called PriceD1, PriceD2, PriceD3 etc until PriceD7 which hold the values.

Starting from PriceD1, I want to compare the price value to the following day, PriceD2 and so on until the price changes. I then want to write out the price so that it looks something like this:

Mon - Fri: 500.00;Sat:600;Sun:700

If the price for Sat and Sun were the same, I would want it to look like:
Mon - Fri: 500.00;Sat- Sun:600

and so on.

Is anyone able to point me in the right direction with this ?










__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar