473,804 Members | 3,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1487
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!ChangeLinenD ate = 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******@parad ise.net.nz> wrote in message
news:b0******** *************** ***@posting.goo gle.com...
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
2832
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 sorting i.e. sort by col1 asc, then by col2 desc etc. Can anyone help ?
22
4174
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) { return -1; } else
4
10040
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 have a .getxml method (unlike the dataset). any ideas? thanks.
1
2645
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 < b simply means that b < a can't be set, also it must be a != b. >And with three objects a < b , b < c means a < c > >I studied Quick Union Find algorithms a bit and if I understood them >correctly, once the user gives the input setting the...
7
10088
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 C++) just doesn't explain things good at all and the tutorials I've viewed don't really explain least significant digit first sorting or show examples, which would be most helpful. I've commented the section where I know that the iteration of the...
16
6434
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 sorting (because it's ultimately being consumed in a GridView). I can't simply sort the ArrayList (because it only knows it's holding a bunch of objects). So I need a way to sort the ArrayList, based on the data - that is within the objects that...
4
4288
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 is stored in a double linked list, the whole list is sorted for the next round. My problem appears when subjecting the program to heavy load, that is, when I run the simulation for more than 10,000 miliseconds (every event occurs in...
6
3347
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 good for viewing it sorted, but I need it to actually _be_ sorted, and testing seems to show that the view doesn't do the trick. If I iterate through the rows in my code and look at the sorted column in each step, it's not sorted. Now, I can...
0
1027
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 bye private void Sort_DataGrid(object source, System.Web.UI.WebControls.DataGridSortCommandEvent Args e) { SqlCommand myCommand = new SqlCommand("SELECT * FROM Categories",myConnection);
8
2206
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" Me.GroupLevel(1).ControlSource = "FirstName") ..... And another post that was OrderByOn = True and setting the sort Order.
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7616
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.