Custom XML ribbon not loading and Callback bombing out (1 Viewer)

equus

Member
Local time
Today, 13:48
Joined
Mar 22, 2022
Messages
31
Upgrading from Access 2010.adp to Access 2013.accdb. Based on the user group, a custom ribbon is supposed to deploy. No ribbon deploys and I get a callback error "user-defined type not define" on Public Sub FrmButtonPress(ctl As IRibbonControl). I really can't figure out what the problem is. 2013 is obviously different than 2010.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:48
Joined
Oct 29, 2018
Messages
21,469
Best way to troubleshoot something like that is to see a sample file. Until then, we at least need to see the ribbon xml and the callback code.
 

equus

Member
Local time
Today, 13:48
Joined
Mar 22, 2022
Messages
31
This is the code for the form callback:

'Callback for Form OnButtonPress
Public Sub FrmButtonPress(ctl As IRibbonControl)
On Error GoTo FrmButtonPress_Err

DoCmd.OpenForm ctl.Tag

FrmButtonPress_Exit:
Exit Sub
 

Attachments

  • XML Ribbon File1.txt
    26.4 KB · Views: 139

theDBguy

I’m here to help
Staff member
Local time
Today, 13:48
Joined
Oct 29, 2018
Messages
21,469
This is the code for the form callback:

'Callback for Form OnButtonPress
Public Sub FrmButtonPress(ctl As IRibbonControl)
On Error GoTo FrmButtonPress_Err

DoCmd.OpenForm ctl.Tag

FrmButtonPress_Exit:
Exit Sub
Hi. Thanks for posting the code. I got it to work as soon as I added a reference to the Office 16.0 Object Library. Double check your references and make sure you have the same one checked.
 

equus

Member
Local time
Today, 13:48
Joined
Mar 22, 2022
Messages
31
I am confused, I though Office 16.0 was for Access 2016 and not 2013? I don't have 2016.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:48
Joined
Oct 29, 2018
Messages
21,469
I am confused, I though Office 16.0 was for Access 2016 and not 2013? I don't have 2016.
Oh, sorry. I am using 2016, so I had 16.0. For you, make sure you have 14.0 or 15.0 (whichever applies to 2013) checked. Do you already have it checked?
 

equus

Member
Local time
Today, 13:48
Joined
Mar 22, 2022
Messages
31
Not sure what you're asking. I cannot post the database, way to big and it's controlled information.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:48
Joined
Oct 29, 2018
Messages
21,469
Not sure what you're asking. I cannot post the database, way to big and it's controlled information.
No, not the actual database - just a sample with enough objects to reproduce the problem. Like I said, I took your XML and callback function and put them in my own database, and it worked fine. So, there must be something different with your database file.
 

equus

Member
Local time
Today, 13:48
Joined
Mar 22, 2022
Messages
31
Should I be using DAO or ADODB? I have attached a copy of my module.
 

Attachments

  • Module.txt
    38.3 KB · Views: 148

LarryE

Active member
Local time
Today, 13:48
Joined
Aug 18, 2021
Messages
589
This is the code for the form callback:

'Callback for Form OnButtonPress
Public Sub FrmButtonPress(ctl As IRibbonControl)
On Error GoTo FrmButtonPress_Err

DoCmd.OpenForm ctl.Tag

FrmButtonPress_Exit:
Exit Sub
  1. Your On Error tries to go to somewhere that does not exist. Change FrmButtonPress_Exit: to FrmButtonPress_Err:
  2. What is DoCmd.OpenForm ctl.Tag supposed to do? It's the command to open a form but there is no form to open.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:48
Joined
Oct 29, 2018
Messages
21,469
Should I be using DAO or ADODB? I have attached a copy of my module.
You can use either one or both, but you have to be explicit when you're declaring your object variables to make sure you're using the correct one.

Again, I took your entire module and put it in a brand new database file with your ribbon XML, and it worked fine for me.
 

equus

Member
Local time
Today, 13:48
Joined
Mar 22, 2022
Messages
31
The ctl.Tag comes from the XML ribbon. No matter what user group is logged into the database, when they click on form to open from the ribbon it opens that particular form . Works in 2010, as well as the FrmButtonPress_Exit. I am very confused. What are the correct references to have for 2013? I currently have the following: Visual Basic For Applications, Microsoft Access 15.0 Object Library, Microsoft ActiveX Data Objects 6.1 Library, OLE Automation, Microsoft Office 15.0 Access database engine Object Library, and Microsoft Excel 15.0 Object Library, and Microsoft Word 15.0 Object Library.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:48
Joined
Oct 29, 2018
Messages
21,469
The ctl.Tag comes from the XML ribbon. No matter what user group is logged into the database, when they click on form to open from the ribbon it opens that particular form . Works in 2010, as well as the FrmButtonPress_Exit. I am very confused. What are the correct references to have for 2013? I currently have the following: Visual Basic For Applications, Microsoft Access 15.0 Object Library, Microsoft ActiveX Data Objects 6.1 Library, OLE Automation, Microsoft Office 15.0 Access database engine Object Library, and Microsoft Excel 15.0 Object Library, and Microsoft Word 15.0 Object Library.
For ADO, you'll also need Microsoft ActiveX Database Object Library (or something like that).

Sent from phone...
 

LarryE

Active member
Local time
Today, 13:48
Joined
Aug 18, 2021
Messages
589
Upgrading from Access 2010.adp to Access 2013.accdb. Based on the user group, a custom ribbon is supposed to deploy. No ribbon deploys and I get a callback error "user-defined type not define" on Public Sub FrmButtonPress(ctl As IRibbonControl). I really can't figure out what the problem is. 2013 is obviously different than 2010.
I have never had to move from an .adp environment to .accdb, but the only time I ever used callbacks for a custom ribbon, I had to use the following Public Declaration and Public Function. I don't know if that will help or not.
Code:
Option Compare Database
Public CustomRibbon As IRibbonUI

Public Function CallbackOnLoad(Ribbon As IRibbonUI)
Set CustomRibbon = Ribbon
End Function
 

equus

Member
Local time
Today, 13:48
Joined
Mar 22, 2022
Messages
31
Same original error, user type not define on the Public Sub FrmButtonPress (ctl As IRibbonControl)
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:48
Joined
Oct 29, 2018
Messages
21,469
Same original error, user type not define on the Public Sub FrmButtonPress (ctl As IRibbonControl)
That simply says you either have the wrong reference or don't have it at all or you misspelled the object name. I will repeat though, I didn't get any errors when I copied your XML and module onto my system.
 

Users who are viewing this thread

Top Bottom