Graphical Seating chart

I am designing a ticketing program for a local non-profit organization ( A Symphony Orchestra )  using microsoft access.  My question is this:

How can I create a graphical seating chart of the auditorium so that seats are color coded for occupied, vacant, etc and seats are mouse selectable.

I would like to included this in an Access form.  Any suggestions would be helpful

Thanks
MB
mattbriceAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
One possibility would be to use something like the MSFlexgrid, you set the number of rows and columns to reflect the seating arrangement and also the colours of each individual cell can be set to show the seat status.

You can place an instance of the microsoft flexgrid on an access form and using the _click event check the status and change it as you wish.

I have used something similar to present a year view of a calendar for booking employee holidays, sickness and other absences using VB.

Of course it does depend on whether you can satisfactorily represent the physical layout of the auditorium within a row/col grid. If you can then it will certainly be an easy way of doing so.
0
mark2150Commented:
Generate a graphic showing the seating chart (ie scan it). Save as .BMP.

In your Paint program, go in an make sure that all seats are closed (no gaps). Additionally note the X/Y co-ords of any point inside each seat. Write these down and save them in a data table along with the seat number.

When you want to display the seating chart, have a PictureBox with .AutoSize True. Load the saved image. Now go thru your seating table and use the FloodFill API call starting at the X/Y point saved for that particular seat. The flood fill should fill up that single seat with the color you've specified.

The following is from Appleman's "VB5 Programmers Guide to the Windows32 API"

-----------------------------------

FloodFill

VB Declaration
Declare Function FloodFill& Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, _
ByVal y As Long, ByVal crColor As Long)

Description
Fills an area in the specified device context using the currently selected brush. The area is defined by color crColor.

Use with VB
No problem.

Parameter      Type/Description
hdc      Long—Handle to a device context.
x,y      Long—Point at which to begin filling in logical coordinates.
crColor      Long— Boundary color to use. The surface bounded by this color is filled.

Return Value
Long—Nonzero on success, zero on failure. Sets GetLastError.

Platform
Windows 95, Windows NT, Win16

Comments
Point X,Y must not have color crColor, and must be within the clipping region. This function only works on raster devices.

-----------------------------------

M

0
LewyCommented:
There is an Operator interface package Wonderware Intouch that can be configured to do what you want. It is expensive about $7,000.00.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

TimCotteeHead of Software ServicesCommented:
Lewy, as an InTouch/InTrack programmer I would agree that this could be used reasonably easily to produce the desired result however as this is for a local non-profit organisation, the outlay along with the learning curve etc far outweighs any (dubious) benefits of using the Wonderware package. I think that Mark2150's suggestion is perhaps better than mine though requires perhaps more skill and knowledge to implement. Using another development package is probably not worthwile.
0
mcriderCommented:
Here's the start of something for you using MSFlexGrids.


1) Create a new project.

2) Add two MSFlexGrids to the project, you dont have to size them or anything, the program does that...

3) Add a MODULE to your project and insert the following code in the DECLARATIONS SECTION of the module:

    Global Const IsleColor = &H404040
    Global Const VacantColor = &HFF00&
    Global Const OccupiedColor = &HFF&
    Global Const StartSeatNumber = 101
   
    Type RowCol
        Row As Long
        Col As Long
    End Type
    Function GetRowColFromIndex(Index As Long, Cols As Long) As RowCol
        Dim iVal As Long
        Dim lIndex As Long
       
        iVal = 0
        lIndex = Index
        Do
            If lIndex < Cols Then Exit Do
            lIndex = lIndex - Cols
            iVal = iVal + 1
        Loop
        GetRowColFromIndex.Row = iVal
        GetRowColFromIndex.Col = lIndex
    End Function
   


4) Add the following code to the DECLARATIONS SECTION of Form1:

    Private Sub Form_Load()
        Dim SeatMap As String
        Dim TotalRows As Long
        Dim SeatsInRow As Long
        Dim iVal As Long
        Dim jVal As Long
        Dim rc As RowCol
        Dim SeatNumber As Long
       
        'This is a seat map. An "X" is a seat, a space is a isle
        'or a missing seat. You can modify this map to put the
        'correct number of seats and rows. Just make sure that
        'all of the rows are the same size.
        SeatMap = _
        "    XXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXX    " + Chr$(9) + _
        "  XXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXX  " + Chr$(9) + _
        " XXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXX " + Chr$(9) + _
        "XXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX" + Chr$(9) + _
        "XXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX" + Chr$(9) + _
        "XXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX" + Chr$(9) + _
        "XXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX" + Chr$(9) + _
        "                                            " + Chr$(9) + _
        "    XXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXX    " + Chr$(9) + _
        "  XXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXX  " + Chr$(9) + _
        " XXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXX " + Chr$(9) + _
        "XXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX" + Chr$(9) + _
        "XXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX" + Chr$(9) + _
        "XXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX" + Chr$(9) + _
        "XXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXXXX" + Chr$(9)
   
        'FIGURE OUT SEATS AND ROWS FROM THE SEATMAP
        SeatsInRow = InStr(1, SeatMap, Chr$(9))
        TotalRows = 1
        iVal = SeatsInRow + 1
        Do
            iVal = InStr(iVal, SeatMap, Chr$(9))
            If iVal = 0 Then Exit Do
            iVal = iVal + 1
            TotalRows = TotalRows + 1
        Loop
           
        With MSFlexGrid2
            .Visible = False
            .FixedRows = 0
            .FixedCols = 1
            .Rows = TotalRows
            .Cols = SeatsInRow
        End With
       
        With MSFlexGrid1
            .Enabled = False
            .Top = 0
            .Left = 0
            .FixedRows = 0
            .FixedCols = 1
            .Rows = TotalRows
            .Cols = SeatsInRow
            For iVal = 0 To .Rows - 1
                .TextMatrix(iVal, 0) = "Row " + CStr(iVal + 1)
            Next iVal
            For iVal = 1 To .Cols - 1
                .ColWidth(iVal) = .RowHeight(0)
            Next iVal
            iVal = 1
            SeatNumber = StartSeatNumber
            For jVal = 1 To Len(SeatMap)
                rc = GetRowColFromIndex(iVal, .Cols)
                Select Case Mid$(SeatMap, jVal, 1)
                    Case "X"
                        .TextArray(iVal) = "X"
                        MSFlexGrid2.TextArray(iVal) = CStr(SeatNumber)
                        SeatNumber = SeatNumber + 1
                        .Row = rc.Row
                        .Col = rc.Col
                        .CellBackColor = VacantColor
                        iVal = iVal + 1
                    Case " "
                        .Row = rc.Row
                        .Col = rc.Col
                        .CellBackColor = IsleColor
                       
                        iVal = iVal + 1
                    Case Chr$(9)
                        SeatNumber = StartSeatNumber
                        iVal = iVal + 1
                End Select
            Next jVal
            .Enabled = True
        End With
    End Sub
    Private Sub Form_Resize()
        With MSFlexGrid1
            .Width = Me.Width - 120
            .Height = Me.Height - 340
        End With
    End Sub
    Sub MSFlexGrid1_DblClick()
        Select Case MSFlexGrid1.CellBackColor
            Case VacantColor
                MSFlexGrid1.CellBackColor = OccupiedColor
            Case OccupiedColor
                MSFlexGrid1.CellBackColor = VacantColor
        End Select
    End Sub
    Private Sub MSFlexGrid1_EnterCell()
        With MSFlexGrid1
            If .Enabled = False Then Exit Sub
            If .CellBackColor = IsleColor Then
                Me.Caption = App.ProductName
                Exit Sub
            End If
            Me.Caption = App.ProductName + " - Row " + CStr(.Row + 1) + _
            " Seat " + MSFlexGrid2.TextMatrix(.Row, .Col)
        End With
    End Sub
    Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
        If KeyAscii = 13 Then MSFlexGrid1_DblClick
    End Sub



5) Run the program...

When you click on a seat, the title bar will change, giving the seat information. Double-click on a seat or press ENTER and the seat will change from available to sold...  Do it again, and it will change back...


Hope this helps!


Cheers!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mark2150Commented:
Flexgrids of any type are not going to give a good result. There are too many "non rectangles" in a venue to consider.

Tracking the raw seating is *NOT* sufficient. You need to *accurately* portray the relations between the seats, stage and any obsticles (columns, posts, stairways, etc.) so that a person can tell a "good" seat from a "bad" seat. Just a grid with the correct number of seats and rows in it will *NOT* solve his problem.

If you've ever bought tickets to an event via TicketMaster or TKTs they have a flip book with photocopies of the floorplans of the various venues. These are proportional sketches, not just tabular listing. Manu venues have "seating in the round" or "bowl" type layouts that will NOT fit in a grid.

No, the solition is to color a graphic. That way the graphic can accurately represent the venue. Yes it will be labor intensive to scan, clean up (make sure each seat is closed so the flood fill won't escape), note and enter the X/Y of the seat, but is only practical way to get the result he's after. Tabular is nice, tabular is wonderful, tabular is not going to solve this problem.

M
0
mcriderCommented:
mark2150,

Did you try the flexgrid example I gave?
0
mattbriceAuthor Commented:
Thanks for all the advice guys,

I am not familiar with flexgrid, although initially it looks like it might do the trick.  I am going to experiment with it for a liitle while, as well as other options.

 Thanks for the code!!

Actually, the auditorium that I need the floor plan for is a simple rectangular shape, with all the seats inline.  

MB
0
mark2150Commented:
Ok, if everthing is nice-nice rectangle then mcriders solution is simplest. If you have an arena or non-rectangular seating then my approach is called for.

M
0
mattbriceAuthor Commented:
I think I am on the right track with the flexgrid control, but can anyone tell me where I can get some detailed documentation on how to use/program the control?  Thanks

MB
0
mcriderCommented:
Actually the help pages are pretty good... highlight the control and press F1


Cheers!
0
mattbriceAuthor Commented:
mcrider,

Thanks for the code, but I seem to be getting a run time error with part of it, and i cannot seem to figure out what is going on....

When i try to click a cell, the sub runs
Private Sub MSFlexGrid1_EnterCell()
        With MSFlexGrid1
            If .Enabled = False Then Exit Sub
            If .CellBackColor = IsleColor Then
                Me.Caption = App.ProductName
                Exit Sub
            End If
            Me.Caption = App.ProductName + " - Row " + CStr(.Row + 1) + _
            " Seat " + MSFlexGrid2.TextMatrix(.Row, .Col)
        End With
    End Sub

I get a an error saying "Variable uses an Automation type not supported in Visual Basic" from the line
"If .CellBackColor = IsleColor Then " I cannot seem to figure out the problem. This statement is used in another block of code, but this time it doesn't seem to work.  Any ideas?

MB
0
mcriderCommented:
mattbrice,

Are you using VB5 or VB6?

When adding the MSFlexGrid Control to your project, does the component title that you are selecting look like this:

   Microsoft FlexGrid Control 5.0 (SP2)


If you haven't installed Service Pack 3 for VB, then you need to... There were several fixes for the FlexGrid control in Service Pack 2 and Service Pack 3...

Check out the following Microsoft page:

INFO: Visual Studio 97 Service Packs - What, Where, and Why
http://support.microsoft.com/support/kb/articles/Q170/3/65.ASP 
 

Cheers!
0
mcriderCommented:
By the way, that code works perfectly on my Win95/98/NT systems...


Cheers!
0
mattbriceAuthor Commented:
mcrider,

I guess it is my fault that i neglected to clarify that I am not using VB, i am completely developing the app in Access itself, which, of course, uses VBA. Any further ideas would be great...

MB
0
mattbriceAuthor Commented:
mcrider,

I have figure out a way to get the code to work in just Access, using VBA.  Thanks for the code, it is a big help.  I wanted to give TimCottee some points for first proposing flexgrid, but I don't know how.  Sorry Tim.

MB
0
mcriderCommented:
Thanks for the points! Glad I could help!

If you want to give TimCottee some points, open a new question with the title "FOR TimCottee ONLY" and assign some points to the question.  Be sure to mention this question (Q.10290059)...


Cheers!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.