Results 1 to 2 of 2
  1. #1
    MattRGM is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    4

    UDF to count days and convert them to month/week/day.

    Recently, my parents have bought a campground and I agreed to attempt to build a database which they can useto keep track of openings, reservations and I want to be able to now calculate the price for the customer. I know I can easily create an "invoice" using the forms.
    Originally, I thought this would be easy and it actually wasn't too difficult, I had everything set up to go. Then I hit a snag. The prices are by days, weeks, months and season and get slightly cheaper for each tier you go up. Charging for a week is cheaper than charging the daily rate seven times, makes sense right? it makes it difficult for me because, I'll use the example of nine days, for a stay like this you would charge for one week and two days. I can't just convert the days stayed into a number like 1.3 weeks and multiply it by the weekly rate because it would be undercharging the customer by about $30 and this number would go up as the stay got longer. I know I could do something like an "IIf" statement but in order to cover all the variables, that would be a long equation with lots of spots where a mistake could be made.


    
    Through doing research, and asking here, I figured that it would be best to develop a UDF which would take the number of days stayed and convert it to something which would count them and turn it into a number like "1 week, 2 days". From there I will have to figure out how to make it so that the program knows which sections to multiply by which rates to build the price. I have taken a course in Access and have a huge book relating to the subject but I'm not quite sure where to begin.
    
    I can easily go through and make it so that these are numbers which the user enters themselves and will have no problem doing that if I need to. I just wanted to see if anyone had advice on how to go about making that idea work first, to cut out some manual steps if necessary.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Can you please show us your tables and relationships (do a screen capture of your relationships window) as a jpg? I recommend you identify and verify your proposed business rules. These are critical to designing your database.

    Here's a free data model regarding hotel reservation to help you get started. Here are the rules/facts about the business.

    I'm suggesting these because of your post count. I really think you should work through this tutorial to get familiar with rules, tables, attributes, relationships and Normalization.

    Good luck with your project.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 06-17-2014, 12:11 AM
  2. Replies: 2
    Last Post: 12-31-2013, 08:19 AM
  3. Counting Days of the Week
    By losingmymind in forum Reports
    Replies: 10
    Last Post: 12-23-2013, 03:30 PM
  4. Start a report on week 40 of a week count
    By aspitalnick in forum Reports
    Replies: 8
    Last Post: 11-28-2012, 04:53 PM
  5. How to Calculate days of the week
    By djclntn in forum Database Design
    Replies: 3
    Last Post: 02-26-2011, 11:10 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums