We help IT Professionals succeed at work.

Access 2007 user-defined type not defined for user-interface code

rdperkins
rdperkins asked
on
Medium Priority
1,338 Views
Last Modified: 2013-11-27
I downloaded some code demonstrating how to create custom menus and menu buttons for Access 2007. I'm receiving the user-defined error message. Checking solutions, most talk about a broken reference to DAO. I tried to reference DAO 3.6 but it said there was a conflict. See the code below.

It breaks on "Public objRibbon As IRibbonUI"
'declaration
Public objRibbon As IRibbonUI
 
Public Sub OnRibbonLoad(objRib As IRibbonUI)
 
Set objRibbon = objRib
 
End Sub
 
'our callback for the SampleButton
Public Sub OnButtonPress(ctl As IRibbonControl)
 
If (ctl.ID = "SampleButton") Then
 
MsgBox ("You have just executed the OnButtonPress callback when clicking" _
& vbCrLf & "the Ribbon SampleButton!")
 
End If
 
End Sub

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016

Commented:
where did you place
Public objRibbon As IRibbonUI ?

it should be placed in a Regular Module not in the Form's module

Author

Commented:
It is in a regular module, named modTestRibbon, and shows up with all the other modules in the navigation pane under modules. The code shown is the only code in the module.
CERTIFIED EXPERT
Top Expert 2016
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
I tried this before your answer, and it worked, but your suggestion was spot on. Thanks.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.