Redesigning the database at work

Singh400

Registered User.
Local time
Today, 21:09
Joined
Oct 23, 2008
Messages
137
We currently have a database that we use a work, while it does its purpose, the database design is not the best, nor does it follow best practices in my opinion.

Therefore, I am in the process of redesigning it from scratch. While I can do this, I need a little help here and there.

I should explain what we use the database for:

We provide interpreters to who ever requires them. We use the database to keep track of appointments whether they took place or not, payments to the interpreters, charges to the Service User (here on in referred to as SU). The Organisation and Departments that use our services. So for example, might have Organisation A, but only Department B will use us. Invoice address; sometimes addressed to a specific person, but usually only the Finance department.

The tables:
tblBookings’ <- Details of bookings, name, time, date etc etc
tblFinance’<- Details of payment incoming and outgoing.
tblInt’ <- List of all our interpreters, how much they get paid an hour, what langs they speak etc etc
tblInvoice_Addresses’ <- Details of the people we invoice, who use our services
tblInvoice_Dates’ <- To keep track of what invoices have been sent to Finance, for which week ending etc etc
tblService_Users’ <- List of all the SUs that use our services.
tblVenue’ <- A list of common venues (where the intepretation will take place)

The first major problem is that all payments incoming and outgoing is mish mashed within the ‘tblBookings’. I plan to separate this out in ‘tblFinance’. Then use a query to pull relevant information for Finance from ‘tblBookings’ and ‘tblFinance’ then combine into one form ‘frmFinance’.

Couple of things I would like to implement, but don’t know how:

Q1) I would like to have cascading combo boxes on ‘frmBookings’ (based directly off ‘tblBookings’. I think this is what they are called. So when you select Organisation A, you are only able to select Department X, Y and Z from the following combo box. I assume this is done somewhere on the form controls (maybe in row source and stuff like that?). Information required for this bit of magic is all contained in ‘tblService_Users’.

Q2) When you select a Language (lets say French) for a booking the only interpreters you can select for the booking (from the cboIntID) are the ones who speak French (would this be cascading combo boxes again or a fancy SQL statement with a WHERE clause?).

Q3) Regarding ‘frmFinance’, I would like some of the fields here to automatically populated such as payments for interpreters. What our interpreters are paid an hour will be listed in ‘tblInt’. How do I achieve this? Any agencies we use need to be exclude from this.

Q4) Some of the fields in ‘frmFinance’ are being calculated on the form, but no actual data is being inputted into ‘tblFinance’. An example of this would be the field ‘IntTotalFee’. This amount is obtained by adding together: =[IntFee] + [IntTravel] + [IntAddtionalCost]. While this is calculated on the form perfectly fine, I would like this data to be stored in the respective table.

Q5) Been thinking about creating a tblLang which will hold all the languages that we provide. I would also like to use a relationship of sorts to tie each interpreter with whatever languages they speak (many-to-many?). Perhaps this could be half of a solution to Q2.

It might be worth mentioning that while we have our own interpreters, we do use agencies. So anything that filters out our interpreters via a filter will need to exclude any agencies we use.

Thanks for any help!
 
Q1. Search this forum for "cascading comno". there have been some helpful posts about this.

Q2. Cascading Combos would be a sensible way to go.

Q3. just populate the box on the form with the formula

Q4. It's not really a good idea to store calculated values in the table. It's so easyu to calculate the total when you need it and that way it is always accurate.

Q5. TblLang is a good idea. it would be a many/many relationship so you need a junction table.
 
Q1. Search this forum for "cascading comno". there have been some helpful posts about this.
Cheers. Managed to do that bit relatively easy (just looked at some demos, and changed the code accordingly). However, so of the departments need to be excluded from the cascading combos code. So they must appear in all Organisation, is there anyway I can adapt the code to do this?

This is the code I'm using:

Code:
Private Sub Organisation_AfterUpdate()
    On Error Resume Next
    Department.RowSource = "Select tblService_Users.Department " & _
        "FROM tblService_Users " & _
        "WHERE tblService_Users.Organisation = '" & Organisation.Value & "' " & _
        "ORDER BY tblService_Users.Department;"
End Sub

Q2. Cascading Combos would be a sensible way to go.
Yep, gonna do this now aswell.

Q3. just populate the box on the form with the formula
I'm sorry what formula? I'm being slightly thick here. But what I would like to happen on frmFinance is when I navigate to different records. For the form (or whatever underlying query) to say "oh this is Interpreter A, he/she gets paid £XX per hour." But when I navigate to different record (ie booking) and the interpreter is different, the £xx per hour should change according to what IntID is associated for that booking.

Q4. It's not really a good idea to store calculated values in the table. It's so easyu to calculate the total when you need it and that way it is always accurate.
Ah ok. Point taken.

Q5. TblLang is a good idea. it would be a many/many relationship so you need a junction table.
Having a little trouble with this. I assume you mean somehting like....

tblInt
IntID [PK]
...other fields...

tblLang
Lang [should this be a PK?]

tblIntLang (is this my junction table?)
IntID
Lang

Coloured names indicate that they will be linked in Relationship Manager.

Cheers for the help Rabbie.
 
Cheers. Managed to do that bit relatively easy (just looked at some demos, and changed the code accordingly). However, so of the departments need to be excluded from the cascading combos code. So they must appear in all Organisation, is there anyway I can adapt the code to do this?

This is the code I'm using:

Code:
Private Sub Organisation_AfterUpdate()
    On Error Resume Next
    Department.RowSource = "Select tblService_Users.Department " & _
        "FROM tblService_Users " & _
        "WHERE tblService_Users.Organisation = '" & Organisation.Value & "' " & _
        "ORDER BY tblService_Users.Department;"
End Sub

Yep, gonna do this now aswell.

I'm sorry what formula? I'm being slightly thick here. But what I would like to happen on frmFinance is when I navigate to different records. For the form (or whatever underlying query) to say "oh this is Interpreter A, he/she gets paid £XX per hour." But when I navigate to different record (ie booking) and the interpreter is different, the £xx per hour should change according to what IntID is associated for that booking.
As I don't know how you are calculating the value I used formula as a shorthand. You would need to use the hourly rate for the particular interpreter.
Ah ok. Point taken.

Having a little trouble with this. I assume you mean somehting like....

tblInt
IntID [PK]
...other fields...

tblLang
Lang [should this be a PK?]

tblIntLang (is this my junction table?)
IntID
Lang

Coloured names indicate that they will be linked in Relationship Manager.

Cheers for the help Rabbie.
That looks like the correct format for a junction table.
 
As I don't know how you are calculating the value I used formula as a shorthand. You would need to use the hourly rate for the particular interpreter.
Had a brainwave while at work today, and did it there and then. :D
That looks like the correct format for a junction table.
Aye cheers.

I'm all out of questions. Do have one regarding Cascading Combo boxes, but I think that deserves a seperate topic and in a different sub-forum.

Thank you very much for all the Rabbie!
icon14.gif
 

Users who are viewing this thread

Back
Top Bottom