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.
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
Comment