N
NateB2
I made a custom ribbon for a form in Microsoft Access (the XML is posted
below). I then created a callback function for "getpressed" in VBA to
retrieve the checkbox value. I then run another function when the checkbox
is pressed. When I load the custom ribbon, I receive the "Function or macro
cannot be found" message. What am I doing wrong?
XML:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<contextualTabs>
<tabSet idMso="TabSetFormReportExtensibility">
<tab id="EnterSyllabusTab" label="Options">
<group id="QuickLinks" label="Quick Links">
</group>
<group id="Options" label="Options">
<checkBox id ="AutoFillRecordsChk" label="Auto-fill new
records?" supertip="Check this to automatically fill in data for new records."
onAction="SyllabusAutoFillChkbox"
getPressed="GetSyllabusAutoFillChkbox" />
</group>
<group idMso="GroupClipboard"></group>
<group idMso="GroupRecords"></group>
<group idMso="GroupSortAndFilter"></group>
<group idMso="GroupFindAccess"></group>
</tab>
</tabSet>
</contextualTabs>
</ribbon>
</customUI>
VBA in "Ribbon" module:
Option Compare Database
Function SyllabusAutoFillChkbox(control As IRibbonControl, pressed As Boolean)
Select Case control.ID
Case "AutoFillRecordsChk"
If pressed = True Then
DoCmd.RunSQL "UPDATE Preferences SET Preferences.PreferenceValue
= True WHERE (((Preferences.PreferenceID)=3));" 'PreferenceID 3 is this
checkbox
Else
DoCmd.RunSQL "UPDATE Preferences SET Preferences.PreferenceValue
= false WHERE (((Preferences.PreferenceID)=3));" 'PreferenceID 3 is this
checkbox
End If
End Select
End Function
Function GetSyllabusAutoFillChkbox(ByVal control As IRibbonControl, ByRef
pressed)
Select Case control.ID
Case "AutoFillRecordsChk"
pressed = DLookup("PreferenceValue", "Preferences", "[PreferenceID]=3")
'PreferenceID 3 is this checkbox
End Select
End Function
below). I then created a callback function for "getpressed" in VBA to
retrieve the checkbox value. I then run another function when the checkbox
is pressed. When I load the custom ribbon, I receive the "Function or macro
cannot be found" message. What am I doing wrong?
XML:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<contextualTabs>
<tabSet idMso="TabSetFormReportExtensibility">
<tab id="EnterSyllabusTab" label="Options">
<group id="QuickLinks" label="Quick Links">
</group>
<group id="Options" label="Options">
<checkBox id ="AutoFillRecordsChk" label="Auto-fill new
records?" supertip="Check this to automatically fill in data for new records."
onAction="SyllabusAutoFillChkbox"
getPressed="GetSyllabusAutoFillChkbox" />
</group>
<group idMso="GroupClipboard"></group>
<group idMso="GroupRecords"></group>
<group idMso="GroupSortAndFilter"></group>
<group idMso="GroupFindAccess"></group>
</tab>
</tabSet>
</contextualTabs>
</ribbon>
</customUI>
VBA in "Ribbon" module:
Option Compare Database
Function SyllabusAutoFillChkbox(control As IRibbonControl, pressed As Boolean)
Select Case control.ID
Case "AutoFillRecordsChk"
If pressed = True Then
DoCmd.RunSQL "UPDATE Preferences SET Preferences.PreferenceValue
= True WHERE (((Preferences.PreferenceID)=3));" 'PreferenceID 3 is this
checkbox
Else
DoCmd.RunSQL "UPDATE Preferences SET Preferences.PreferenceValue
= false WHERE (((Preferences.PreferenceID)=3));" 'PreferenceID 3 is this
checkbox
End If
End Select
End Function
Function GetSyllabusAutoFillChkbox(ByVal control As IRibbonControl, ByRef
pressed)
Select Case control.ID
Case "AutoFillRecordsChk"
pressed = DLookup("PreferenceValue", "Preferences", "[PreferenceID]=3")
'PreferenceID 3 is this checkbox
End Select
End Function