UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Connection Between Login Form And Ribbon, Access 2016    
 
   
Davecogz84
post Aug 2 2019, 09:24 AM
Post#1



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">
</dropDown>

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

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

'(4)
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: 8
 
Go to the top of the page
 
theDBguy
post Aug 2 2019, 09:56 AM
Post#2


Access Wiki and Forums Moderator
Posts: 76,567
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Welcome to UtterAccess!
welcome2UA.gif

I haven't tried it before but have you tried if you can set a default value to the ribbon dropdown? If so, then maybe you can change the default value when you invalidate the control.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
theDBguy
post Aug 5 2019, 03:17 PM
Post#3


Access Wiki and Forums Moderator
Posts: 76,567
Joined: 19-June 07
From: SunnySandyEggo


Hi Dave. Not sure if you already got it fixed but I gave it a try and attached is the result of my tests. Hope it helps...

Attached File(s)
Attached File  Testing.zip ( 51.43K )Number of downloads: 14
 

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
Davecogz84
post Aug 13 2019, 11:14 PM
Post#4



Posts: 2
Joined: 12-February 19



Thanks so much, the DBguy. Your solution worked a charm. It was all about the default. One other clear fault with my previous method was that the column I'd called ExtraID (which was telling the combo box the order in which to put the combo items) was missing a zero. i.e. the first item in that list should have been zero.

Thanks again!
Go to the top of the page
 
fo_007_fo
post Aug 14 2019, 01:32 AM
Post#5



Posts: 1
Joined: 14-August 19



thankss!
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    18th November 2019 - 02:18 AM