Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating frontdesk database for motel 1

Status
Not open for further replies.

akash4

Technical User
Jan 30, 2005
4
US
hi..
i am not a programmer. i manage a motel & i'm creating a database for frontdesk..i created a combo box connecting to a table which has discount types..such AAA, AArp & so on..now what i really want to do is that when i click on this drop down menu & choose AAA discount..it shoud automatically deduct 10% from actual rate & then add the amount of tax to the discounted rate...i don't know how to write a code for this...would someone help me please....?

thank u...
 
First of all...
What database software you use?
MS Access ? Oracle ? Alpha ?....??
Version?


Zameer Abdulla
JVBP MDS
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
Search for "Using Select Case Statements" in the VBA help file. You have to be in the code window to get this help file.
For further discussions you are welcome to any of these forums dedicated to Access
Microsoft: Access Forms Forum
Microsoft: Access Modules (VBA Coding) Forum
Microsoft: Access Queries and JET SQL Forum
Microsoft: Access Reports Forum
Microsoft: Access Tables and Relationships Forum
Microsoft: Access Other topics Forum
Regards

Zameer Abdulla
JVBP MDS
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
thanx...i'll try this & i also need to work on other functionality of this database i'm trying to create so as i get hurdles...i'll definately ask for help again..

thanx again...
 
hi....

i would like to have a code on 'after update event' for the following...it will be very helpful of u..

as i wrote previously..i'm working on hotel frontdesk database...don't have programming knoledge though...
i created a combo box....
caption
Discount Type: Discount Type (COMBO BOX)
AAA //(1st choice)
AARP //(2nd choice)

Rate: Rate (just a regula field)

now what i really want is that after inserting the rate in the rate field...when i choose a discount type..
for instance: AAA, it shoud deduct 10% of the actual rate that has been inserted manually into the Rate field..

i just would like to get a code for this...it would be a such a big help..

thanx...

 
Before working on coding (and forms), it is prudent to review and ensure your database is designed effeciently. This process is called "normalization". If your database is designed well, the retrieval of information should be fairly simple. If the design is poor, then retrieving information can be very tough.

A common approach by some new to relational databases is to use what I call a "spreadsheet mentality". Whereas the idea and the power of a database is to avoid redundency.

Please consider the following reference sites...
Fundamentals of Relational Database Design
Download document
Read on-line (HTML)

Micro$oft's answer...
283878 - Description of the database normalization basics
304467 - ACC2000 Defining Relationships Between Tables in a Microsoft Access Database

...Moving on
When working with forms and such, it is easier to assist those looking for assistance when provided with enough information.

A key tool with forms is to use the "Properties" window. Open your form in design mode, and then from the menu, select "View" -> "Properties". The "Properties" window will have five tabs -- format, data, events, other and all. You can look at the properties for the form by selecting the top left square on the form where the verticle and horizontal rulers meet.

Some Important form properties...
- RecordSource (data tab)
- various Events, OnCurrent, BeforeUpdate, AfterUpdate, OnLoad, OnOpen...

You can select controls on the form such as text, combo and list boxes. Some important control properties...
- Name (other) - you can change the name but do so BEFORE creating any code
- ControlSource (data)
- RowSource and BoundColumn for combo boxes (data)
- Visible (format)
- ColumnCount and ColumnWidths for combo boxes (format)
- various Events - AfterUpdate, OnDoubleClick, OnNotInList

Knowing the Name is very important since any coding must reference the correct controls.

Richard
 
A relational model is indeed the most efficient for certain tasks but only when efficiency is defined in terms of storage space. Access doesn't enforce all the requirements of a relational database and that's what makes it such a usable tool.

There has to be a trade-off between the redundancies in a flat file and the complexity of a relational design. Remember that Codd was developing Relational Theory in 1968 when disk space cost a fortune and there was no such thing as an end-user.

Geoff Franklin
 
In access you can make up a form and do this on a form and have the form use code to display your information.

You may want to start with a field for the rate that is in a table with the discount code and name. That way you can join to the lookup table and use that value. Then you can use that discount to compute the end result and use that to update your table you are storing their bill or charge in.

Look for computed fields in Access.

It is either to look at a 10% discount as multiplying the amount by 90%. I think this makes an easier computation than computing the discount and subtracting it.

You could display the normal charge and the discount name and rate and then make a computed field to display the end result and use that to add with the Tax and other misc charges.

If you are printing a bill you could display the normal rate and then display the discount as a negative charge so you can show the customer how much the discount saved them from the standard rate. You may even want the standard rate to be charged to all bills and stored as such and then store the discount on a separate line as a negative charge. That way you can sum the colum and it will make sense.

If you do not like my post feel free to point out your opinion or my errors.
 
The best way to handle your combo box for the aaa rate would be to use the after_update property for the combo box.

Here is an example for a combo box named combo1,
and a price control named Text1

Sub Combo1_AfterUpdate()
If Combo1.value = 1 Then
Text1.Value = Text1.Value *.9
ElseIf Combo1.value = 2 Then
Text1.Value = Text1.Value *.85
End If

End Sub

So, this code will change the price of the room by 10 or 15 percent depending on which value you choose. This is assuming you used a number as the bound column for your combo box control
 
A better solution would be to feed the combo box from a DiscountTypes table. Where you have

DiscountID
DiscountName
DiscountRate

This not only allows for easier expansion as discounts are added but also allows for easier updating of your dscount rates and also reporting. A good hotel system can e quite complex on the backend, and designing the DB model before you write any code will save you a lot of work and frustration in the long run.

Shoot Me! Shoot Me NOW!!!
- Daffy Duck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top