Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002

    Unanswered: Grids in MS Access


    I've been trying to add an activeX control grid to the forms.
    I've been downloading a number of activex control and registering them.
    I can see the control but it seems that the properties are not available.
    Why is it so? I've been doing this for 2 days!!

    I wonder if any of u guys got any idea how to get a grid control since msacess doesn't have them..I'd be really grateful !! I'm at my wit's end..
    I would just need to display my data in a grid table..
    Appreciate the time and help...

  2. #2
    Join Date
    Aug 2002
    I have used listboxes to emulate grids with success.

    You will have to write a function to populate the listbox. Here is an example... the listbox is a 'picky' control and will only accept an array, so this function converts a recordset to an array and supplies it to the listbox when you set the name of the function as the RowSourceType property... Good luck!

    Public Function EnumAllRecall(fld As Control, id As Variant, row As Variant, col As Variant, code As Variant) As Variant
    'Purpose: Supplies all Recalls to a listbox by opening a recordset,
    ' converting it into an array, which is the only thing the listbox will accept
    'Usage: Set the listbox's RowSourceType property to EnumAllRecall and leave
    ' its RowSource property blank
    'Notes: All arguments are provided to the function automatically
    'Author: Maia 05/20/02

    Dim db As Database
    Dim rst As Recordset
    Static iCount As Integer
    Static aAllRecall As Variant

    'respond to the supplied value of code

    Select Case code

    Case acLBInitialize 'called once when form opens, initializes the listbox
    Set db = CurrentDb()

    Set rst = db.OpenRecordset("SELECT tblRecall.RecallID, tblRecall.RecallDesc, tblRecallStatus.Status FROM tblRecallStatus INNER JOIN tblRecall ON tblRecallStatus.RecallStatusID = tblRecall.StatusID; ")

    If rst.RecordCount = 0 Then
    MsgBox "No recalls matching criteria have been found.", vbOKOnly
    aAllRecall = ""


    'get number of rows
    iCount = rst.RecordCount

    'populate array with recordset

    With rst
    aAllRecall = .GetRows(.RecordCount)
    End With
    EnumAllRecall = iCount

    End If

    Set db = Nothing
    Set rst = Nothing

    Case acLBOpen
    EnumAllRecall = Timer

    Case acLBGetRowCount
    EnumAllRecall = iCount

    Case acLBGetColumnCount
    EnumAllRecall = 3

    Case acLBGetColumnWidth
    EnumAllRecall = True

    Case acLBGetValue
    EnumAllRecall = aAllRecall(col, row)

    Case acLBEnd
    Erase aAllRecall
    iCount = 0

    End Select

    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts