473,395 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Sorting out the logic

Hi there

Can anyone help me with the logic that I require please?

I operate a Bed & Breakfast business and one aspect of the business
that I have not been able to complete in the programme which I have
developed is one for when to change the linen etc.

The criteria is as follows –

1 night stay – change linen
2 nights stay – change linen
3 nights stay – change the linen
4 nights stay or longer– change the linen every second day.

The reservation programme has the following to fields –

RoomNo (Number of each room)
Begindate (which is the first day of their stay)
NoOfNights (which obviously determines the number of stay nights and
the day they are booking out.)

I would like to create a table which will list the Rooms which need to
be changed as per any given day in accordance with the criteria
above.. TIA to anyone who can quickly answer this. Thanks - Ray
Nov 13 '05 #1
1 1465
Hi Ray

This will require you to write some VBA code to open a recordset, loop
through the dates, and append records. If you are comfortable with writing
VBA code, this logic should do it.

You want to change the linen:
- on the day the booking terminates;
- each 2nd day of the booking, if it is for 4 nights or more.

The first one is easy: presumably you have a BeginDate and EndDate fields,
so it is the same as the EndDate. The basic logic for the in-between dates
will be something like this:
Dim dt As Date
Dim rs As DAO.Recordset
If DateDiff("d", BeginDate, EndDate) >= 4 Then
Set rs = dbEngine(0)(0).OpenRecordset("tblLinenChange",
dbOpenDynaset, dbAppendOnly)
For dt = BeginDate + 2 To EndDate -1 Step 2
rs.AddNew
rs!RoomID = RoomID
rs!ChangeLinenDate = dt
rs.Update
Next
rs.Close
End If
Set rs = Nothing

You will also have to deal with removing these bookings (or extending them)
if the client alters their EndDate.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Ray Pearson" <as******@paradise.net.nz> wrote in message
news:b0**************************@posting.google.c om...
Hi there

Can anyone help me with the logic that I require please?

I operate a Bed & Breakfast business and one aspect of the business
that I have not been able to complete in the programme which I have
developed is one for when to change the linen etc.

The criteria is as follows -

1 night stay - change linen
2 nights stay - change linen
3 nights stay - change the linen
4 nights stay or longer- change the linen every second day.

The reservation programme has the following to fields -

RoomNo (Number of each room)
Begindate (which is the first day of their stay)
NoOfNights (which obviously determines the number of stay nights and
the day they are booking out.)

I would like to create a table which will list the Rooms which need to
be changed as per any given day in accordance with the criteria
above.. TIA to anyone who can quickly answer this. Thanks - Ray

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Gareth Gale | last post by:
I'm trying to implement a way of allowing a user to sort a HTML table via Javascript on the client. I've seen lots of samples where single column sorting (asc or desc) is shown, but I'd like nested...
22
by: mike | last post by:
If I had a date in the format "01-Jan-05" it does not sort properly with my sort routine: function compareDate(a,b) { var date_a = new Date(a); var date_b = new Date(b); if (date_a < date_b)...
4
by: suzy | last post by:
hello. how can i sort data in a dataset? all the examples i have seen on msdn, etc are sorting a dataview. this works fine, but i want to return the results in xml and the dataview doesn't...
1
by: aredo3604gif | last post by:
On Sun, 10 Apr 2005 19:46:32 GMT, aredo3604gif@yahoo.com wrote: >The user can dynamically enter and change the rule connection between >objects. The rule is a "<" and so given two objects: >a <...
7
by: Foodbank | last post by:
Hi everyone. I'm having trouble with this radix sorting program. I've gotten some of it coded except for the actual sorting :( The book I'm teaching myself with (Data Structures Using C and...
16
by: RCS | last post by:
So I have an ArrayList that gets populated with objects like: myAL.Add(new CustomObject(parm1,parm2)); I'm consuming this ArrayList from an ObjectDataSource and would like to have this support...
4
by: FBM | last post by:
Hi, I am working on a program that simulates one of the elements of ATM. The simulation stores events which occurs every some milliseconds for a certain amount of time. Every time that an event...
6
by: David P. Donahue | last post by:
I've been looking around for ways to sort the rows in a DataTable, and everything seems to point to just changing the Sort property on that DataTable's DefaultView property. That's all well and...
0
by: gopi2ks | last post by:
HI I USE THIS below code for sorting but, when we are click sorting columns , then it will showing the next page rows in sorting also, i need only this page rows only sorting waiting for ur reply...
8
by: sara | last post by:
Hi - I have looked at all posts and tried both Allen Browne's Report Sorting at run Time ( Select Case Forms!frmChooseSort!grpSort Case 1 'Name Me.GroupLevel(0).ControlSource = "LastName"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.