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
> User Name On The Ribbon Label, Access 2016    
 
   
marinko888
post Oct 29 2019, 12:35 PM
Post#1



Posts: 80
Joined: 9-April 19



Hi,
I have an issue after Ribbon has been displayed Login form has been loaded and then I would like to display User name dynamically on the Ribbon label. How can I do that?
This is before the Login form has loaded:

Attached File  user.PNG ( 1.36K )Number of downloads: 2


VBA:
Public Sub GetUserNameRibbon(control As IRibbonControl, ByRef label)
label = "User: "
End Sub

Thanks for any suggestions!

Go to the top of the page
 
theDBguy
post Oct 29 2019, 12:54 PM
Post#2


UA Moderator
Posts: 76,910
Joined: 19-June 07
From: SunnySandyEggo


Hi. Check out the InvalidateControl method.

--------------------
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
 
marinko888
post Oct 29 2019, 01:30 PM
Post#3



Posts: 80
Joined: 9-April 19



Thanks!
Your suggestion has pointed me in the right direction.
Go to the top of the page
 
theDBguy
post Oct 29 2019, 03:12 PM
Post#4


UA Moderator
Posts: 76,910
Joined: 19-June 07
From: SunnySandyEggo


Congratulations! Glad to hear you got it to work. Good luck with your project.

--------------------
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
 
marinko888
post Oct 29 2019, 03:21 PM
Post#5



Posts: 80
Joined: 9-April 19



Hi,
when I am using gobjRibbon object in the Form from the XML callback:

If Not gobjRibbon Is Nothing Then
gobjRibbon.InvalidateControl ("btnUserID")
End If

I am getting the error: object variable not set:

Attached File  error.PNG ( 2.6K )Number of downloads: 3


but it has been set in the callback as:

Public gobjRibbon As IRibbonUI

Sub OnRibbonLoad(ribbon As IRibbonUI)
Set gobjRibbon = ribbon
End Sub

What am I missing here? Any help is appreciated.

Go to the top of the page
 
theDBguy
post Oct 29 2019, 04:06 PM
Post#6


UA Moderator
Posts: 76,910
Joined: 19-June 07
From: SunnySandyEggo


What does your ribbon XML look like?

--------------------
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
 
marinko888
post Oct 29 2019, 04:23 PM
Post#7



Posts: 80
Joined: 9-April 19



It looks like this:

<?xml version="1.0" encoding="utf-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="OnRibbonLoad" loadImage="LoadImages">
<commands>
<command idMso="Help" enabled="false"/>
<command idMso="WindowClose" enabled="true"/>
<command idMso="WindowRestore" enabled="true"/>
<command idMso="WindowMinimize" enabled="false"/>
</commands>

<ribbon startFromScratch="false">
<tabs>
<tab id="tab0" label="ENTER DATA" getVisible ="GetVisible" tag = "RibbonName:=ultraRibbon2019;CustomTagValue1:=;CustomTagValue2:=;CustomTagVa
lue3:=" >
<group id="grp0" autoScale="true" centerVertically="true" label=" " getVisible ="GetVisible" tag = "RibbonName:=ultraRibbon2019;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;Cu
stomTagValue3:=;CustomPicture:=;CustomPicturePath:=" >
<button id="btnUserID" size="large" getLabel="GetLabel" getImage="GetImages" tag="RibbonName:=ultraRibbon2019;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;Cu
stomTagValue3:=;CustomPicture:=person.ico;CustomPicturePath:=C:\Pics\" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
</group>
</tab>
</tabs>
</ribbon>
<backstage>
<button idMso="FileCloseDatabase" visible="false"/>
<button idMso="FileSave" visible="false"/>
<button idMso="SaveObjectAs" visible="false"/>
<button idMso="FileSaveAsCurrentFileFormat" visible="false"/>
<button idMso="FileOpen" visible="false"/>
<button idMso="FileCloseDatabase" visible="false"/>
<tab idMso="TabInfo" visible="false"/>
<tab idMso="TabOfficeStart" visible="false"/>
<tab idMso="TabRecent" visible="false"/>
<tab idMso="TabNew" visible="false"/>
<tab idMso="TabSave" visible="false"/>
<tab idMso="TabPrint" visible="false"/>
<tab idMso="TabHelp" visible="false"/>
<tab idMso="TabRecent" visible="false"/>
<tab idMso="TabOfficeFeedback" visible="false"/>
<button idMso="ApplicationOptionsDialog" visible="true"/>
<button idMso="FileExit" visible="true"/>
</backstage>
</customUI>
Go to the top of the page
 
marinko888
post Oct 30 2019, 03:03 AM
Post#8



Posts: 80
Joined: 9-April 19



I have found the error. I was using gobjRibbon.InvalidateControl ("btnUserID") in a click button action. Instead of that, you have to make a subroutine and then inside the click button use subroutine name.

Public Sub myfunction()
gobjRibbon.InvalidateControl ("btnUserID")
End Sub

Private Sub btnLogin_Click()
myfunction
End Sub
Go to the top of the page
 
theDBguy
post Oct 30 2019, 08:14 AM
Post#9


UA Moderator
Posts: 76,910
Joined: 19-June 07
From: SunnySandyEggo


Hi. Glad to hear you got it sorted out. Good luck with your project.

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


Custom Search


RSSSearch   Top   Lo-Fi    15th December 2019 - 01:57 PM