Solved

Importing Flex Grids into a New Project

Posted on 2008-06-23
14
1,697 Views
Last Modified: 2013-11-29
I have set up an access system which will take bookings for a company.  The user ideally wants to have it in a calendar style (like Outlook), so I am trying to implement a FlexGrid.  I was given a sample code by a friend of mine (not sure if he wrote it being honest), and Ive tried to import this to my program in order to use it as a basis for a Flexgrid of my own.  However I keep getting errors.  Im basically now looking for help on how to implement a flexgrid as quickly as possible


The current form for inputting bookings is very basic.  Code as follows
====================================
Option Compare Database

Private Sub ChckBkngs_Click()
On Error GoTo Err_ChckBkngs_Click

    Dim stDocName As String

    stDocName = "Booking_Data Query"
    DoCmd.OpenReport stDocName, acPreview

Exit_ChckBkngs_Click:
    Exit Sub

Err_ChckBkngs_Click:
    MsgBox Err.Description
    Resume Exit_ChckBkngs_Click
   
End Sub

Private Sub pricechck_Click()
On Error GoTo Err_pricechck_Click

    Dim stDocName As String

    stDocName = "Treatments_Data Query"
    DoCmd.OpenReport stDocName, acPreview

Exit_pricechck_Click:
    Exit Sub

Err_pricechck_Click:
    MsgBox Err.Description
    Resume Exit_pricechck_Click
   
End Sub
====================================

The Flex Grid code is next below. Now I have never used a flex grid before so I really could use the help here.  Ive attached a jpg of my current form & of the flexgrid I would ideally love to get.

====================================

Option Compare Database
Option Explicit

Const conCream As Long = 13303807
Const conNavy As Long = 8404992
Const conPaleGreen As Long = 13434828
Const conLightBlue As Long = 16760445

Private Sub btnClose_Click()
    DoCmd.Close
End Sub

Private Sub Form_Activate()
   
'Re-display FlexGrids when form Activated

    FillCalendarGrid                        'display Calendar FlexGrid
    ShowAppointments                        'display appointments FlexGrid
   
End Sub

Private Sub Form_Open(Cancel As Integer)
   
    txtMonth = Month(Date)                  'set Month to this month
    txtYear = Year(Date)                    'set Year to this year
    txtToday = Date                         'set today's date

End Sub

Private Sub fraMode_AfterUpdate()
   
    ShowAppointments                                                                                'update appts

End Sub


Public Sub ShowDay()

'Shows flex grid as current day
'Entry  (txtToday) = Date to be displayed
'       (tblDiary) holds appointments

Dim vRow As Long, vRow2 As Long
Dim vTime As Date
Dim rst As Recordset

    On Error GoTo ErrorCode

    flxDates.Redraw = False                                                                     'switch off Redraw first
    flxDates.Clear                                                                              'clear all cells
    flxDates.Cols = 2                                                                           'set No of cols = 2
    flxDates.FixedRows = 1                                                                      'set No of fixed Rows = 1
    flxDates.FixedCols = 1                                                                      'set No of fixed Columns = 1
    flxDates.ScrollBars = 0                                                                     'set No scroll bars reqd
    flxDates.MergeCol(1) = True                                                                 'set Merge on Col 1

    flxDates.ColWidth(0) = 800                                                                  'Width for Col 0 = 800 twips
    flxDates.ColWidth(1) = 10300                                                                'Width for Col 1 = 10300 twips
    flxDates.RowHeight(-1) = 278                                                                'Height of all rows = 278 twips

    flxDates.ColAlignment(0) = flexAlignCenterCenter                                            'align Col 0 CenterCenter
    flxDates.ColAlignment(1) = flexAlignLeftCenter                                              'align Col 1 LeftCenter


    SelectRange flxDates, 0, 0, 0, 1                                                            'align Row 0 as
    flxDates.CellAlignment = flexAlignCenterCenter                                              'CenterCenter
   
    SelectRange flxDates, 0, 0, 0, 1                                                            'paint header row only
    flxDates.CellBackColor = conNavy                                                            'in white on navy blue
    flxDates.CellForeColor = vbWhite
   
    vTime = "09:00:00"                                                                          'set work start time as 0900 hours
    vRow = ((Hour(vTime) - 7) * 2)                                                              'calc row No for start time
    If Minute(vTime) >= 30 Then vRow = vRow + 1
    If vRow > 0 Then                                                                            'skip if < 07:00
        SelectRange flxDates, 1, 0, vRow, 1                                                     'paint first rows in cream (0700-0830)
        flxDates.CellBackColor = conCream
    End If

    vTime = "17:00:00"                                                                          'set work end time as 1700 hours
    vRow = ((Hour(vTime) - 7) * 2) + 1                                                          'calc row No for start time
    If Minute(vTime) >= 30 Then vRow = vRow + 1
    If vRow < 29 Then
        SelectRange flxDates, vRow, 0, 28, 1                                                    'paint last rows in cream (1700-2030)
        flxDates.CellBackColor = conCream
    End If

    flxDates.TextMatrix(0, 0) = "Time"                                                          'show header text
    flxDates.TextMatrix(0, 1) = "Diary appointments for " & Format(txtToday, "dddd  d mmmm yyyy")
   
    vTime = "07:00:00"                                                                          'show times for each appointment line (30 min intervals)
    For vRow = 1 To 28
        flxDates.TextMatrix(vRow, 0) = Format(vTime, "hh:nn")
        vTime = DateAdd("n", 30, vTime)
    Next
   
    For vRow = 1 To 28 Step 2                                                                   'set whole hour rows in bold font
        flxDates.Row = vRow
        flxDates.Col = 0
        flxDates.CellFontBold = True
    Next

'Copy appointments from tblDiary to grid
    Set rst = CurrentDb.OpenRecordset("SELECT * FROM tblDiary WHERE StartDate = #" _
    & Format(txtToday, "m-d-yyyy") & "#")                                                       'make list of appointments for selected date from tblDiary
    Do Until rst.EOF                                                                            'then copy them to appropriate rows
        vRow = ((Hour(rst!StartTime) - 7) * 2) + 1                                              'calc row No for start time
        If Minute(rst!StartTime) >= 30 Then vRow = vRow + 1                                     'add 1 to row if minutes part >= 30
        vRow2 = (DateDiff("n", rst!StartTime, rst!EndTime)) / 30                                'calc difference between start time and end time
        flxDates.TextMatrix(vRow, 1) = Nz(rst!Notes)                                            'show Notes field
        If vRow2 > 1 Then                                                                       'if appt is over 30 mins then
            Do While vRow2 > 1                                                                  'add extra rows for remaining time
                vRow = vRow + 1                                                                 'next row
                flxDates.TextMatrix(vRow, 1) = Nz(rst!Notes)                                    'copy Notes to field to allow merge option
                vRow2 = vRow2 - 1                                                               'dec counter
            Loop
        End If
        rst.MoveNext                                                                            'next appointment
    Loop
    rst.Close
    Set rst = Nothing
    flxDates.Redraw = True                                                                      're-display grid
    Exit Sub

ErrorCode:
    If Not rst Is Nothing Then rst.Close
    Set rst = Nothing
    Beep
    MsgBox Err.Description

End Sub

Public Sub ShowWeek()

'Shows flex grid as current day
'Entry  (txtToday) = Date to be displayed
'       (tblDiary) holds appointments

Dim vRow As Long
Dim vDate As Date, vStartDate As Date
Dim rst As Recordset
Dim vNotes As String, vDates As String

    On Error GoTo ErrorCode

    flxDates.Redraw = False                                                                     'switch off Redraw first
    flxDates.Clear                                                                              'clear all cells
    flxDates.Cols = 2                                                                           'No of cols = 2
    flxDates.FixedRows = 1                                                                      'No of fixed rows = 1
    flxDates.FixedCols = 1                                                                      'No of fixed columns = 1
    flxDates.ScrollBars = 0                                                                     'No scroll bars reqd

    flxDates.ColWidth(0) = 800                                                                  'Col 0 width = 800 twips
    flxDates.ColWidth(1) = 10300                                                                'Col 1 width = 10300 twips

    flxDates.RowHeight(0) = 310                                                                 'set height of row 0 to 310 twips
    flxDates.RowHeight(1) = 450                                                                 'set height of row 1 to 450 twips
    flxDates.RowHeight(2) = 1410                                                                'set height of rows 2-6 to 1410 twips
    flxDates.RowHeight(3) = 1410
    flxDates.RowHeight(4) = 1410
    flxDates.RowHeight(5) = 1410
    flxDates.RowHeight(6) = 1410
    flxDates.RowHeight(7) = 450                                                                 'set height of row 1 to 450 twips
   
    flxDates.ColAlignment(0) = flexAlignCenterCenter                                            'align Col 0 CenterCenter
    flxDates.ColAlignment(1) = flexAlignCenterCenter                                            'align Col 1 CenterCenter
    SelectRange flxDates, 1, 1, 7, 1                                                            'align Col 1, Rows 1-7 as
    flxDates.CellAlignment = flexAlignLeftTop                                                   'LeftTop
   
    SelectRange flxDates, 1, 0, 7, 0                                                            'set bold for col 0
    flxDates.CellFontBold = True
   
    SelectRange flxDates, 0, 0, 0, 1                                                            'paint header row in white on navy blue
    flxDates.CellBackColor = conNavy
    flxDates.CellForeColor = vbWhite
   
    SelectRange flxDates, 1, 0, 1, 1                                                            'paint 1st row in cream (Sun)
    flxDates.CellBackColor = conCream
    SelectRange flxDates, 7, 0, 7, 1                                                            'paint 7th col in cream (Sat)
    flxDates.CellBackColor = conCream

    vDate = txtToday - Weekday(txtToday) + 1                                                    'calc first day of week from txtToday
    vStartDate = vDate                                                                          'and save in vStartDate
    flxDates.TextMatrix(0, 0) = "Date"                                                          'show headers
    flxDates.TextMatrix(0, 1) = "Diary appointments for week commencing Sunday " _
    & Format(vDate, "d mmmm yyyy")
   
    For vRow = 1 To 7                                                                           'enter day and dates in col 0
        flxDates.TextMatrix(vRow, 0) = Format(vDate, "ddd") & vbCrLf & Format(vDate, "dd") _
        & vbCrLf & Format(vDate, "mmm")
        vDate = vDate + 1
    Next
   
    vDates = "#" & Format(vStartDate, "m-d-yyyy") & "# AND #" _
    & Format(vStartDate + 6, "m-d-yyyy") & "#"                                                  'format dates for week as a string

    Set rst = CurrentDb.OpenRecordset("SELECT * FROM tblDiary WHERE StartDate BETWEEN " _
    & vDates & " ORDER BY StartDate, StartTime")                                                'make list of appointments for week in order
    Do Until rst.EOF
        vRow = rst!StartDate - vStartDate + 1                                                   'calc row No from date
        vNotes = Format(rst!StartTime, "hh:nn") & " - " & Format(rst!EndTime, "hh:nn") _
        & "  " & Nz(rst!ClientName) & "  " & "    " & Nz(rst!Notes)                             'fetch times and Notes
        flxDates.TextMatrix(vRow, 1) = flxDates.TextMatrix(vRow, 1) _
        & "  " & vNotes & vbCrLf                                                                'append new notes + CRLF to cell
        rst.MoveNext
    Loop
    rst.Close
    Set rst = Nothing
    flxDates.Redraw = True                                                                      're-display grid
    Exit Sub

ErrorCode:
    If Not rst Is Nothing Then rst.Close
    Set rst = Nothing
    Beep
    MsgBox Err.Description

End Sub

Public Sub ShowMonth()

'Shows flex grid as current day
'Entry  (txtToday) = Date to be displayed
'       (tblDiary) holds appointments

Dim vRow As Long, vCol As Long, vCount As Long, vDays As Long
Dim vFirst As Date, vLast As Date
Dim vFlag As Boolean
Dim rst As Recordset
Dim vMonthYear As String

    On Error GoTo ErrorCode

    flxDates.Redraw = False
    flxDates.Clear

    flxDates.Cols = 7                                                                       'No of cols = 7
    flxDates.MergeRow(0) = True                                                             'set Merge on Row 0
    flxDates.FixedRows = 2
    flxDates.ScrollBars = 0
    flxDates.FixedCols = 0
   
    flxDates.ColWidth(0) = 1570                                                             'Set Col 0 width to 1570 twips
    flxDates.ColWidth(1) = 1584                                                             'Set Col 1-5 width to 1584 twips
    flxDates.ColWidth(2) = 1584
    flxDates.ColWidth(3) = 1584
    flxDates.ColWidth(4) = 1584
    flxDates.ColWidth(5) = 1584
    flxDates.ColWidth(6) = 1570                                                             'Set Col 6 width to 1570 twips
   
    flxDates.RowHeight(-1) = 1250                                                           'set height all rows = 1250 twips
    flxDates.RowHeight(0) = 350                                                             'set height of row 0 = 350 twips
    flxDates.RowHeight(1) = 450                                                             'set height of row 1 = 450 twips

    SelectRange flxDates, 0, 0, 1, 6                                                        'set cell alignment of header rows 0 & 1
    flxDates.CellAlignment = flexAlignCenterCenter
    SelectRange flxDates, 2, 0, 7, 6                                                        'set cell alignment of rows 2-6
    flxDates.CellAlignment = flexAlignLeftTop

    SelectRange flxDates, 0, 0, 0, 6                                                        'paint header row in white on navy blue
    flxDates.CellBackColor = conNavy
    flxDates.CellForeColor = vbWhite
    flxDates.CellFontBold = True                                                            'set header font to bold
   
    SelectRange flxDates, 2, 0, 7, 0                                                        'paint 1st col in cream (Sun)
    flxDates.CellBackColor = conCream
    SelectRange flxDates, 2, 6, 7, 6                                                        'paint 7th col in cream (Sat)
    flxDates.CellBackColor = conCream

    SelectRange flxDates, 1, 0, 1, 6                                                        'paint header row 2 in white on Light blue
    flxDates.CellBackColor = conLightBlue
    flxDates.CellFontBold = True                                                            'and in bold
    vMonthYear = Format("1-" & txtMonth & "-" & txtYear, "mmmm  yyyy")                      'enter date in header

    For vCol = 0 To 6                                                                       'set header for Col 0
        flxDates.TextMatrix(0, vCol) = "Diary Appointments for " & vMonthYear
        flxDates.TextMatrix(1, vCol) = Format(vCol + 1, "dddd")                             'set day names for Row 1
    Next

'Show dates in calendar first
    vFirst = DateSerial(txtYear, txtMonth, 1)                                                           'set vFirst = first date of month
    vDays = DateSerial(Year(vFirst), Month(vFirst) + 1, 1) - DateSerial(Year(vFirst), Month(vFirst), 1) 'set vDays = No of days in current month
    vLast = DateSerial(txtYear, txtMonth, vDays)                                                        'set vLast = last date of month
    vFlag = False
    vCount = 1
    For vRow = 2 To 7
        For vCol = 0 To 6
            If vFlag = False Then                                                                       'skip if 1st day done
                If vCol = Weekday(vFirst) - 1 Then                                                      'if Col No = weekday No then
                    vFlag = True                                                                        'set flag when 1st of month set
                    flxDates.TextMatrix(vRow, vCol) = vCount & vbCrLf                                   'copy day number to grid
                    vCount = vCount + 1                                                                 'inc counter
                End If
            Else
                flxDates.TextMatrix(vRow, vCol) = vCount & vbCrLf                                       'copy day number to grid
                vCount = vCount + 1
                If vCount > vDays Then Exit For
            End If
        Next
        If vCount > vDays Then Exit For
    Next

'Copy scheduled dates to grid from table tblDiary
    Set rst = CurrentDb.OpenRecordset("SELECT * FROM tblDiary WHERE StartDate BETWEEN #" _
    & Format(vFirst, "m-d-yyyy") & "# AND #" & Format(vLast, "m-d-yyyy") & "#")                         'return list of scheduled dates in current month
    Do Until rst.EOF = True                                                                             'copy result of query grid
        vDays = Day(rst!StartDate)
        For vRow = 2 To 7
            For vCol = 0 To 6
                If Left(flxDates.TextMatrix(vRow, vCol), 2) = vDays Then
                    flxDates.Row = vRow
                    flxDates.Col = vCol
                    flxDates.CellBackColor = conPaleGreen                                               'paint cell in light green
                    flxDates.TextMatrix(vRow, vCol) = flxDates.TextMatrix(vRow, vCol) _
                    & Nz(rst!ClientName) & vbCrLf                                                  'add 1st 19 chrs to cell
                End If
            Next
        Next
        rst.MoveNext                                                                                    'next record (if any)
    Loop
    rst.Close
    Set rst = Nothing
    flxDates.Redraw = True
    Exit Sub

ErrorCode:
    If Not rst Is Nothing Then rst.Close
    Set rst = Nothing
    Beep
    MsgBox Err.Description

End Sub

Public Sub FillCalendarGrid()

'Display calendar for current month
'Entry  (txtMonth) = month number (1-12)
'       (txtYear) = year

Dim rst As Recordset
Dim vCount As Long, vRow As Long, vCol As Long, vDays As Long
Dim vFirst As Date
Dim vFlag As Boolean
Dim vMonthYear As String

    On Error GoTo ErrorCode

    flxCal.Redraw = False                                                               'turn off screen updating
    flxCal.ColWidth(-1) = 450                                                           'set all col widths to 450
    flxCal.RowHeight(-1) = 450                                                          'set all row heights to 450
    flxCal.RowHeight(0) = 300                                                           'set row 0 height to 300
    flxCal.RowHeight(1) = 300                                                           'set row 1 height to 300

    flxCal.ColAlignment(-1) = flexAlignCenterCenter                                     'Align all columns Centre-Centre (4)
    flxCal.MergeRow(0) = True                                                           'merge cells in row 0
    flxCal.Clear                                                                        'clear all cells

'Show header titles
    vMonthYear = Format("1-" & txtMonth & "-" & txtYear, "mmmm  yyyy")                  'set vMonthYear to 1-current month-current year
    flxCal.TextMatrix(0, 0) = "<<"
    flxCal.TextMatrix(0, 1) = vMonthYear
    flxCal.TextMatrix(0, 2) = vMonthYear
    flxCal.TextMatrix(0, 3) = vMonthYear
    flxCal.TextMatrix(0, 4) = vMonthYear
    flxCal.TextMatrix(0, 5) = vMonthYear
    flxCal.TextMatrix(0, 6) = ">>"

    flxCal.TextMatrix(1, 0) = "Sun"                                                     'show days of week
    flxCal.TextMatrix(1, 1) = "Mon"
    flxCal.TextMatrix(1, 2) = "Tue"
    flxCal.TextMatrix(1, 3) = "Wed"
    flxCal.TextMatrix(1, 4) = "Thu"
    flxCal.TextMatrix(1, 5) = "Fri"
    flxCal.TextMatrix(1, 6) = "Sat"
   
    SelectRange flxCal, 2, 0, 7, 6                                                      'paint all rows in white first
    flxCal.CellBackColor = vbWhite

    SelectRange flxCal, 1, 0, 1, 6                                                      'paint 2nd row in light blue (Sun Mon Tue Wed Thu Fri Sat)
    flxCal.CellBackColor = conLightBlue
   
    SelectRange flxCal, 2, 0, 7, 0                                                      'paint 1st col in cream (Sun)
    flxCal.CellBackColor = conCream
    SelectRange flxCal, 2, 6, 7, 6                                                      'paint 7th col in cream (Sat)
    flxCal.CellBackColor = conCream

    SelectRange flxCal, 2, 0, 7, 6                                                      'set alignment to Centre-Centre for all squares
    flxCal.ColAlignment(-1) = flexAlignCenterCenter
   
    SelectRange flxCal, 0, 0, 0, 6                                                      'show 1st row in Bold
    flxCal.CellFontBold = True
   
'Show dates in calendar
    vFirst = DateSerial(txtYear, txtMonth, 1)                                                           'set vFirst = first date of month
    vDays = DateSerial(Year(vFirst), Month(vFirst) + 1, 1) - DateSerial(Year(vFirst), Month(vFirst), 1) 'set vDays = No of days in current month
    vFlag = False
    vCount = 1
    For vRow = 2 To 7
        For vCol = 0 To 6
            If vFlag = False Then                                                                       'skip if 1st day done
                If vCol = Weekday(vFirst) - 1 Then                                                      'if Col No = weekday No then
                    vFlag = True                                                                        'set flag when 1st of month set
                    flxCal.TextMatrix(vRow, vCol) = vCount                                              'copy day number to grid
                    If CheckToday(vCount) = True Then                                                   'if calendar date = today then
                        SelectRange flxCal, vRow, vCol, vRow, vCol                                      'paint current square in bold/red
                        flxCal.CellFontBold = True
                        flxCal.CellForeColor = vbRed
                    End If
                    vCount = vCount + 1                                                                 'inc counter
                End If
            Else
                flxCal.TextMatrix(vRow, vCol) = vCount                                                  'copy day number to grid
                If CheckToday(vCount) = True Then                                                       'if calendar date = today then
                    SelectRange flxCal, vRow, vCol, vRow, vCol                                          'paint current text in bold/red
                    flxCal.CellFontBold = True
                    flxCal.CellForeColor = vbRed
                End If
                vCount = vCount + 1
                If vCount > vDays Then Exit For
            End If
        Next
        If vCount > vDays Then Exit For                                                                 'exit loop when all days displayed
    Next

'Copy scheduled dates to Calendar grid
    Set rst = CurrentDb.OpenRecordset("SELECT * FROM tblDiary " _
    & "WHERE Month(StartDate) = " & txtMonth & " AND Year(StartDate) = " & txtYear)                     'return list of scheduled dates in current month
    Do Until rst.EOF = True                                                                             'copy result of query grid
        vDays = Day(rst!StartDate)
        For vRow = 2 To 7
            For vCol = 0 To 6
                If flxCal.TextMatrix(vRow, vCol) = vDays Then
                    flxCal.Row = vRow
                    flxCal.Col = vCol
                    flxCal.CellBackColor = conPaleGreen                                                 'paint cell green if any appointments for date
                End If
            Next
        Next
        rst.MoveNext                                                                                    'next record (if any)
    Loop
    rst.Close
    Set rst = Nothing
   
    flxCal.Redraw = True
    Exit Sub

ErrorCode:
    If Not rst Is Nothing Then rst.Close
    Set rst = Nothing
    Beep
    MsgBox Err.Description
   
End Sub

Public Function CheckToday(vDay As Long) As Boolean

'Returns TRUE if vDay = Today's date
'Entry  (vDay) = Date in month
'       (txtMonth) = Month No (1-12)
'       (txtYear) = Year

Dim vDate As Date

    vDate = DateSerial(txtYear, txtMonth, vDay)
    If vDate = Date Then CheckToday = True

End Function

Private Sub flxCal_Click()

'User clicks on calendar grid

Dim vCol As Long, vRow As Long
Dim vText As String
Dim vDate As Date
   
    FlexGridClick flxCal, vRow, vCol, vText                             'return Row, Col & Contents of selected cell
    If vRow = 0 And vCol = 0 Then DecMonth: Exit Sub                    'if user clicks << then decrement month (and year)
    If vRow = 0 And vCol = 6 Then IncMonth: Exit Sub                    'if user clicks << then increment month (and year)
   
    If vRow > 1 Then                                                    'if user clicks on a date box then
        If vText <> "" Then                                             'if not blank then
            vDate = vText & "-" & txtMonth & "-" & txtYear              'calc new date
            txtToday = vDate                                            'and copy to txtToday field
            ShowAppointments                                            're-display date list
        Else                                                            'if User clicks on blank cell then
            If fraMode = 2 Then                                         'if WEEK mode then
                For vCol = 0 To 6
                    If vText <> "" Then                                 'if not blank then
                        vDate = vText & "-" & txtMonth & "-" & txtYear  'calc new date
                        txtToday = vDate                                'and copy to txtToday field
                        ShowAppointments                                're-display date list
                    End If
                Next
            End If
        End If
    End If

End Sub

Public Sub DecMonth()

'Decrement Month number
'Entry  (txtMonth) = Current Month number
'       (txtYear) = Current Year

    txtMonth = txtMonth - 1                                             'subtract 1 from month
    If txtMonth = 0 Then                                                'if now 0 then
        txtMonth = 12                                                   'change to 12 and
        txtYear = txtYear - 1                                           'decrement Year
    End If
    FillCalendarGrid                                                    're-display calendar grid
    If fraMode = 3 Then ShowAppointments                                'and re-display appointments grid if in MONTH mode

End Sub

Public Sub IncMonth()

'Increment Month number
'Entry  (txtMonth) = Current Month number
'       (txtYear) = Current Year

    txtMonth = txtMonth + 1                                             'add 1 to month
    If txtMonth = 13 Then                                               'if now 13 then
        txtMonth = 1                                                    'change to 1 and
        txtYear = txtYear + 1                                           'increment Year
    End If
    FillCalendarGrid                                                    're-display calendar grid
    If fraMode = 3 Then ShowAppointments                                'and re-display appointments grid if in MONTH mode

End Sub

Public Sub ShowAppointments()

'Update display if user changes modes

    Select Case fraMode
        Case 1                                                          'if DAY mode
            ShowDay                                                     'show appts for selected day
        Case 2                                                          'if WEEK mode
            ShowWeek                                                    'show appts for selected week
        Case 3                                                          'if MONTH mode
            ShowMonth                                                   'show appts for selected month
    End Select

End Sub

====================================

I would really love to get this implemented as soon as I could so any suggestions would be great, Im already behind schedule on the delivery and this is the only remaining holdup.  
bking.JPG
flex.JPG
0
Comment
Question by:Riddler83
  • 7
  • 7
14 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
Riddler83,


Unfortunately, you can't just "Drop-in" a flexgrid and all of its associated code to a different database.

To many things can go wrong.

1. Try reversing it.
Try bringing your data into the a copy of the DB that has the working flexgrid.

2.
Flexgrids are more commonly used in VB than in Access.(VBA)
Click the "Request Assistance" button in your original Question and ask that a link to this Q be placed in the Visual Basic Zone.

3. Why not just use Outlook for this?
This functionality already exists, so there is no need to re-invent the wheel.
And you can be done tomorrow!

JeffCoachman
0
 

Author Comment

by:Riddler83
Comment Utility
I was afraid that would be the case,  How would I go about using Outlook?  Not something Im familiar with myself, and it may do just the job.  Would I need an email account?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
Riddler83,

<How would I go about using Outlook?>
These "Bookings" would be set up as Meetings or Appointments depending on your needs.

<Would I need an email account?>
No, not for the calendar.
However if this info needs to be "shared" you need Exchange Server.
If this Info will be used by one person, it will have to be set up on their machine.
You can "simulate" sharing by creating a Dummy user in Exchange that everyone has Access to.

You guys are not using Outlook already?

JeffCoachman
0
 

Author Comment

by:Riddler83
Comment Utility
Using Gmail really as its cheaper.  Would I be able to link reports etc from Access to the outlook calendar?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
Riddler83,

<Would I be able to link reports etc from Access to the outlook calendar?>
Unfortunately/Incredibly, ... No, ...links to Access reports are blocked in Outlook 2007.
And there is probably a patch in 2003 that blocks them as well.

Were you able to do this in the flexgrid?
If so, how did you enter text?

JeffCoachman
0
 

Author Comment

by:Riddler83
Comment Utility
Havent been able to as yet in the flexgrid.  Thats currently in a sample db my mate gave me.  I have absolutely no clue as to how to go about a flexgrid(only heard of them for the first time last Friday), and my mate is gone off travelling so I cant chase him.  Ideally Id love that style calendar in my access program, if not a flexgrid then whats the best, but the flexgrid seems ideal.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
Riddler83,

Well, if your buddy can get this all to work,
Can't you hold off the delivery of this project till then?

JeffCoachman
 
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Riddler83
Comment Utility
Wish I could!!!!!  Hes of travelling in Oz for 4 months and theres no way I could hold off delivery until he gets back.  Would this be better suited to the VBA section do you reckon as you said above?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
Then tell me *exactly* what you need this system to do.
0
 

Author Comment

by:Riddler83
Comment Utility
Ok, what I have to achieve is a way for the user to take bookings for a salon.  They want the bookings done in a calendar form if possible so they can see at a glance which employee is booked, which room is booked and which times are booked.  I have tables/forms set up re room/employee data, product data etc.

So what I need is a system where the user can input a booking for whenever, and see in front of them in the form all bookings (by day).  The current setup has them with a button to call a report where they can select a day to see bookings but they think this is too cumbersome and want to just be able to "cycle"mthrough days on the form (so they dont need to keep running the report if days are booked out)  The outlook calendar would be ideal,  but they then need to run reports based on the bookings (these are set up already)

Need any specific info let me know
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
Comment Utility
Riddler83,

OK, if you want to go the Outlook route you need to determine who will be "viewing" this information and who will be "editing" it. (Or will they be the same person.
Because if you need any level os sharing beyond the basics, it will require installing an Exchange Server, and all the time and money that entails.

If this will be in Access, it needs to be designed from the ground-up.
That would be more of a Consulting job, rather than something you can ask a question here and get an "answer".

This complexity coupled with your tight time schedule, I suggest you hire a consultant/DBA to help you through this process.

JeffCoachman
0
 

Author Comment

by:Riddler83
Comment Utility
Thanks Jeff for your help.  I will chat to the client and see if they want to go the consultant route, as obviously its their money involved.  Appreciate you taking the time to look at this.  The points are yours for your time
0
 

Author Closing Comment

by:Riddler83
Comment Utility
Many thanks for your input, hopefully Ill be able to work through a solution with client
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
OK
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now