X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Connection Between Login Form And Ribbon, Access 2016    
post Aug 2 2019, 09:24 AM

Posts: 2
Joined: 12-February 19

Dear all,

I'm posting here in the hope that someone can help with something that's been trying my patience for days. The setup is simple:

I have a table with user names; the ribbon has a dropdown (ddcDropDown_) that pulls up the list of users, as does a combo box on the splash form (ComboMain). I would like the user to be able to click on either dropdown, and change the user. When he/she does that, the value will need to be passed from the ribbon to the form, or from the form to the ribbon.

I can get it to work from the ribbon: it passes the value to the form no problem. However, the other way round doesn't work: nothing happens at all. Below is the code I'm using and attached is a pared down version of the file.

Any help will be very much appreciated since I am pulling my hair out about this!

The XML for the dropdown button is:
<dropDown id="ddcDropDown_" label="DropDown:" getItemCount = "fncGetItemCountCbx"
getItemLabel = "fncGetItemLabelCbx" onAction="fncOnChangeCbx" getSelectedItemIndex="GetSelectedItemIndexDropDown" sizeString= "WWWWWWWWWW">

The only form I have is FMSplashAnalysis (that contains the combo box ComboMain) and the only table is TABStaff.

The relevant VBA code is:
(1) On the combo box:
Private Sub ComboMain_AfterUpdate()
lngDropDownValue = Me!ComboMain
gobjRibbon.InvalidateControl "ddcDropDown_"
End Sub

'(2) Relating to the XML
Sub fncGetItemLabelCbx(control As IRibbonControl, index As Integer, ByRef label)
label = DLookup("StaffSurname", "TABStaff", "ExtraID =" & index)
End sub

Sub GetSelectedItemIndexDropDown(control As IRibbonControl, _
ByRef index)
gobjRibbon.InvalidateControl "ddcDropDown_"
' Select Case control.ID
' Case Else
index = lngDropDownValue
' End Select
End Sub

Sub fncOnChangeCbx(control As IRibbonControl, selectedId As String, strText As Long)
Dim strNamePerson As String
strNamePerson = Nz(DLookup("StaffSurname", "TABStaff", "ExtraID=" & strText), "absent")
Dim strID As String
strID = Nz(DLookup("StaffID", "TABStaff", "ExtraID=" & strText), "absent")
[Forms]![FMSplashAnalysis]!ComboMain.Value = strID
End Sub
Attached File(s)
Attached File  Testing.zip ( 65.01K )Number of downloads: 6
Go to the top of the page
Start new topic
post Aug 14 2019, 01:32 AM

Posts: 1
Joined: 14-August 19

Go to the top of the page

Posts in this topic

Custom Search

RSSSearch   Top   Lo-Fi    15th September 2019 - 09:12 PM