Suggestions needed..

Ironis

Learning Member...
Local time
Today, 12:50
Joined
Oct 10, 2002
Messages
61
I have a planningsystem, which has to plan A-groups full, and after that B groupd.

The code calculates if the A-group is full, and will then suggest first other times for reservations, and then if not available it should open a B-group.

Now i have two options:
1) Making an 'invisible' checkbox on the form and in the table,
2) Making a broader calculation

The positive thing about the checkbox is you can see clearly if someone is in a b-group or in an a-group. The negative part is thet I have to remake queries, calculations etc.

On the other hand, the calculations might work.
Per group, ther can be 6 swimmers and 18 encounters, or 12 swimmers and 6 encounters, so I can 'broaden' my calculations.

My question is: what works best, and fastest, and what is the most user-friendly option for future programmers..

Any suggestions, tips or other solutions are welcome!

Dennis (Ironis :cool: )
 
Can noone help me with this? I only need suggestions on how to do this.. I was hinking about a yes/no field, but then I have to double the code, on the other hand, I can use calculations with larger minimums and maximums, but that takes also a lot of code. Does anyone have a suggestion on how I can do this?
 
Dennis,

Could you post your table structure and a little more info
about what you are trying to do.

I can't gather too much about (6 swimmers - 12 encounters) or
(12 swimmers - 6 encounters).

Wayne
 
The tables don't matter that much.

I have one table in which the reservations are stored. It's called tblReservation and has the following fields:

reservationnumber_ID
personcode_ID
programcode_ID
date
number_pers
cost_US
cost_NAF

Reservation ID is used for future reservations (people are given a reservationnumber)
the person ID is the autonumber ID assigned to personal information when filled in (another table)
program ID is the ID of the program which is in the reservation. The programs I use for the planningcode are Encounter and Swim (Local, tourist and on 3 different timeblocks)
date is de date on which the reserved program must take place
number_pers is the total number of persons who are doing the program.

The planning works for a part. We can have two different kind of reservations:

Option 1
12 people swim (4 dolphins)
6 people encounter (1 dolphin)

and

Option 2
6 people swim (2 dolphins)
18 people encounter (3 dolphins)

There can be 2 groups, A and B
So, depending on how the reservations are made, we can have on one timeblock group 1A and 1B (option 1, group a and b)
and 2A, 2B

The code I have now, works only for the 9AM timeblock, and thus it plans only when a 9AM program is filled in. Firast it checks wether the reservation is possible at 9AM, then it goes to NOON, and then to 3PM.

after that, it should go to a B-group. I'm working on that now, it's quite a lot of code, and that sucks. I have this code now only one time, and it has to be tripled.. for the NOON and 3PM timeblocks..

I'm now trying to get the code to work for the B-groups, and I think I'm figuring out, but still, if there is a better solution, it's always welcome.

One piece of the code looks like this:

Code:
Private Sub E9AMLess6()
    Dim spce As Integer
    Dim enc As Integer
    Dim enc2 As Integer
    Dim enc3 As Integer
    Dim swim As Integer
    Dim msg, msg1, Msg2, Msg3, Msg4, title, title1, Title2, Title3, Title4, _
        style, style1, Style2, Style3, Style4
    
'Calculations
    spce = (18 - (sumEnc9AML + sumEnc9AMT))
    enc = (sumEnc9AML + sumEnc9AMT)
    enc2 = (18 - (sumEnc9AML + sumEnc9AMT + txtNumPers))
    enc3 = (sumEnc9AML + sumEnc9AMT + txtNumPers)
    swim = (sumSwim9AML + sumSwim9AMT)
    
'MsgBox Reservation Exactly full
    msg = "Error:" & vbCrLf & vbCrLf & _
            "The 9AM Encounter is currently full.        " & vbCrLf & _
            "  There are " & enc & " encounters booked." & vbCrLf & vbCrLf & _
            " Now checking NOON availability..."
    style = vbOKOnly + vbCritical
    title = "Reservation Error"

'MsgBox Reservation Error (full reservation)
    msg1 = "Error:" & vbCrLf & vbCrLf & _
            "There are only " & spce & " spaces for the 9AM Encounter." & vbCrLf & _
            "  There are " & enc & " bookings for the 9AM Encounter." & vbCrLf & _
            "                 There are " & swim & " Swims." & vbCrLf & vbCrLf & _
            "         Now checking NOON availability..."
    style1 = vbOKOnly + vbCritical
    title1 = "Reservation Error"
    
'MsgBox Reservation Confirmation
    Msg2 = "Are you sure you want to complete this reservation?"
    Title2 = "Complete Reservation?"
    Style2 = vbYesNo + vbQuestion + vbDefaultButton1
    
'MsgBox Reservation Success
    Msg3 = "                Reservation successful." & vbCrLf & vbCrLf & _
            "Now there are " & enc2 & " spaces for the Encounter left."
    Title3 = "Reservation Successful!"
    Style3 = vbOKOnly + vbInformation
    
'MsgBox Reservation Cancelled
    Msg4 = "Reservation Cancelled."
    Title4 = "Cancelled"
    Style4 = vbOKOnly + vbExclamation
    
'There are less then 6 swims, so there can't be more then 18 encounters
'Check if there are already 18 reservations for the encounter, if so, error:
    If enc = 18 Then
        If MsgBox(msg, style, title) = vbOK Then E9AMAdvNOON
    Else
'Check if there are more then 18 encounters. If so, give error:
'reservation is not possible!!
        If enc3 > 18 Then
            If MsgBox(msg1, style1, title1) = vbOK Then E9AMAdvNOON
'Otherwise, ask for confirmation of the reservation
        Else
'If Yes, then store reservation, and say reservation is successful
            If MsgBox(Msg2, Style2, Title2) = vbYes Then
                DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
                MsgBox Msg3, Style3, Title3
            Else
'If No, delete reservation, and say reservation is cancelled
                DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
                cmbResPersID.SetFocus
                MsgBox Msg4, Style4, Title4
            End If
        End If
    End If
End Sub

This piece of code, whows the planning for 9AM Encounter, on the 9AM timeblock, with Option 1, group A.

The other codes, of the other timeblocks look almost the same. The only thing that's different, is the calculations, and the msgboxes.

The most important thing to remove is the huge amount of code, and of course to fix the B-planning..

Hope you can do something with this..

HTH

Dennis
 

Users who are viewing this thread

Back
Top Bottom