Acces can't run the macro or callback function 'fncGetItemCountCbx'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dutch245
    New Member
    • Feb 2014
    • 2

    Acces can't run the macro or callback function 'fncGetItemCountCbx'

    Hello,

    This is my first time trying to modify the ribbon in access. What I am trying to do is have a combobox in the ribbon, which uses the table tblGeneral to populate itself. The field I wish to populate it with is called ReportNum. I found the code below here:



    I tried to modify each sub as neccessary, yet I haven't had any luck.

    Code:
    Sub fncGetItemCountCbx(control As IRibbonControl, ByRef count)
    Dim rs As DAO.Recordset
    Dim strSql As String
    Dim j As Long
               
    ' For the combobox frmClients form, we will make two tasks:
    ' 1st - Inform the quantity of items in the list for the combobox.
    ' 2nd - store in the computer memory, the names of clients who will fill the
    '       list of the ComboBox control.
    '       This memory contents will be used in the fncGetItemLabelCbx function
    '       that will be triggered soon.
    
    ' Build a query of the table tblClients to obtain the records sorted
    ' by the client name.
    strSql = "SELECT ReportNum FROM tblGeneral ORDER BY ReportNum;"
    ' Opens query
    Set rs = CurrentDb.OpenRecordset(strSql)
    rs.MoveLast: rs.MoveFirst
     
    ' Tell the Combobox, by the argument Count, the number of items that
    ' will be used.
     count = rs.RecordCount
     
    ' Determines the number of elements that will be stored at the variable
     ReDim strECR(rs.RecordCount) As String
     
    ' Here its passed to the strNameClient() variable the name of customers,
    ' record by record.
     j = 0
     Do While Not rs.EOF
        strECR(j) = rs!ReportNum
        j = j + 1
        rs.MoveNext
     Loop
     rs.Close
     Set rs = Nothing
                
    End Select
    End Sub
    Last edited by Rabbit; Feb 6 '14, 08:36 PM. Reason: Please use [CODE] and [/CODE] tags when posting code or formatted data.
  • dutch245
    New Member
    • Feb 2014
    • 2

    #2
    this particular sub is the one that gives me an error, saying that access can't run the macro or callback function 'fncGetItemCoun tCbx'.

    Comment

    Working...