473,505 Members | 13,925 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calculating fields from one form to another

111 New Member
I have a form that gives the total amount of Cabins that can be booked, broken out into 3 catergories: OV, Inside, and Balcony. The number of each available cabin is entered at the beginning, and as people book cabins (which is done via a combobox on a different form based off of a different table) i need the available number of cabins to reflect those already booked.

Ex: we're given 3 OV cabins, 3 Inside Cabins, and 3 Balcony cabins to start. Someone books an OV cabin - i need the number of OV to go to 2.

I used a simple IF THEN on the AfterUpdate of the CabinCategory Field like this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Balcony_Category_AfterUpdate()
  2. If Forms![frmPaxInfo]![Category] = "OV" Then
  3.     Forms![frmCabins]![OVAmt] = Forms![frmCabins]![OVAmt] - 1
  4. End If
  5. If Forms![frmPaxInfo]![Category] = "Inside" Then
  6.     Forms![frmCabins]![InsideAmt] = Forms![frmCabins]![InsideAmt] - 1
  7. End If
  8. If Forms![frmPaxInfo]![Category] = "Balcony" Then
  9.     Forms![frmCabins]![BalconyAmt] = Forms![frmCabins]![BalconyAmt] - 1
  10. End If
  11. End Sub
This works as long as someone doesnt change the category of a cabin, as it will just keep subtracting, and not add back on to the one that was originally there. I know i need to use a query(s) to add up the different types of cabins and then subtract that value from the starting total of each in order to keep the values acurate, but i have no clue how to do this.
Aug 16 '07 #1
1 1250
Rabbit
12,516 Recognized Expert Moderator MVP
You don't normally do it this way.
Usually, you have give each cabin an ID. Then as people book Cabins, you keep track of which CabinID is booked and for what date.

And to find out how many Cabins are free you do a find unmatched query against the date range that they want to book the cabin.
Aug 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3220
by: Joe Bongiardina | last post by:
What does the message "calculating...." mean in the lower left status area of a form? I have a form with no calculated, concatenated or lookup fields, yet it displays this msg. The form takes...
7
2126
by: JLM | last post by:
I have a table that has fieldA, fieldB, fieldC. I want fieldC=fieldA-fieldB. simple enough. the next record I want to be able to do the same on the new value of fieldC. I can do this with SAP...
1
2366
by: jlm | last post by:
I have a form which feeds table (TblEmpLeave) of Employee Leave Time (time taken off for Administrative, Annual, Sick, Compensation leave). I have EmpID, LeaveDate, LeaveType, LeaveHours fields on...
2
13586
by: Wayne Aprato | last post by:
I've read most, if not all, of the posts on moving average and still can't find a simple solution to my problem (if a simple solution exists!) I have a table with 2 fields: Hours and Injuries. I...
5
7639
by: RC | last post by:
I have a form with three text boxes on it. I want the third text box to show the total of the values in the other two text boxes. The first box is named: BoxOne and I type the number 2 into it...
3
2678
by: luscus | last post by:
Thanks for all the responses on my first question. Unfortunately the answers I was given were too complicated for my small brain , and neophite condition to understand. So if you could talk down to...
5
2280
by: keith | last post by:
This may seem simple, but I'm having a bit of trouble figuring out exactly how to do it. I'm accessing a database through an ODBC link, and I have a query that returns only jobs completed that day...
3
6893
by: JDiamond | last post by:
Hi, I have a table called Hosts. The Hosts table contains the following fields: Each field represents a step in the project. The tech that completes each step initials the respective...
8
3971
by: King | last post by:
Hi I have following MS Acess query Here is the query ID Name Prgm ID Client ID Date Start Time End Time Minutes C4 Trisha TIP DEK0703 7 /7 /2006...
4
4831
by: zoeb | last post by:
Hi. I have a form which the user enters 2 years worth of data into (one record per year). The aim, is to populate the table this form is based on with 3 more years worth of data (i.e. creating 3...
0
7098
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...
1
7017
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...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5026
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...
0
3187
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...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.