tags:

views:

99

answers:

1

I'm trying to update the ribbons in MS Access 2007. I migrated a database from 2003 to 2007. In the ribbon I created it seems that the "delete" button doesn't work. I think one can adjust it in the VBA code, and I'm not sure what code I'll include. This is so far what I've got in my XML:

<button idMso="Delete" label="Löschen" size="large" />

Does anyone have any idea how to have the "delete" button works?

Further details:

http://picasaweb.google.com/tintincutes/UnbenanntesAlbum#5415113558232954946


In my basRibbonCallbacks here is what I got:

    Sub OnActionButton(control As IRibbonControl)

        Select Case control.Id

             Case "btnOpenFormular"
                DoCmd.OpenForm "FormName"
             Case "btnCloseFrmEingabe"
                DoCmd.Close acReport
             Case "btnDelete"
                DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
                DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
        End Select
    End Sub

In the Case "btnDelete" I'm not really sure what to put here. I can see the "delete button" is not already grayed out but if I select a record on my form and click delete nothing happens. Is the code correct? Thanks

And in my USysRibbons the XML code I got is this:

    <?xml version="1.0" encoding="windows-1252"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"&gt;
        <ribbon startFromScratch="true">
            <tabs> <tab id="tab2" label="Overview" insertAfterMso="TabDatabaseTools">
                    <group id="Group3" label="Navigation">                      
                        <button id="btnDelete" label="Löschen"
                         imageMso="RecordsDeleteRecord" size="large"
                         onAction="OnActionButton" />
                       </group>
                </tab>
            </tabs>
        </ribbon>
    </customUI>
+1  A: 

I think this is related to enhanced security in Access 2007. Read the following article and you will get a hint.

http://office.microsoft.com/en-us/access/HA012301871033.aspx

Saar
thanks. I only would like to have a code for the VBA so that the "delete" button will work. I have tried the other functions like "open form" and in my XML I have this one:<button id="btnClose" size="large" label="Close" onAction="OnActionButton"/>and in my VBA code: I wrote something like this:Case "btnClose"DoCmd.Close acReport, "FormName", acSaveYesI was thinking I can also do that with the "delete" button but I'm not sure what to write in a code.
tintincute
Access options -> select tab "Current database" from left column -> check "Enable layout view for this database" in right panel. This will enable/disable the delete button in access forms/sub forms.
Saar
You probably don't want acSaveYes in the Close command. That saves the DESIGN of the object being closed -- it has nothing to do with data. Also, you're closing a REPORT, so the data behind it is read-only in any case.
David-W-Fenton
@Saar: yes it's already checked. Also the "Enable design changes for tables in Datasheet view (for this database).But it's still not working.
tintincute