[AccessD] bookmark property not working with hotkey for command button

Carolyn Johnson cjlabs at worldnet.att.net
Sat Jul 18 13:07:07 CDT 2009


WinXP  Access2003

I have a form/subform with a command button that finds a record based on a field for the subform.  If I click the command button on the subform, the code works correctly.  If I use the hotkey for the command button (alt + G), the correct record is found (seen by stepping through the code), but then the form reverts back to the first record.


Code for command button:
    currentItem is determined by a combobox on a separate form -- the item being searched

    currentCategory = DLookup("CategoryID", "tblItem", "[ItemID] = " & currentItem)
    Forms![frmCategoryData].RecordsetClone.FindFirst "[CategoryID] = " & currentCategory 
    Forms![frmCategoryData].Bookmark = Forms![frmCategoryData].RecordsetClone.Bookmark
    Forms![frmCategoryData]![frmItemData].Form.RecordsetClone.FindFirst "[ItemID] = " & currentItem
    Forms![frmCategoryData]![frmItemData].Form.Bookmark = Me.RecordsetClone.Bookmark

Since the command button is on the subform, the last 2 lines of code were originally
    Me.Recordsetclone.FindFirst "[ItemID] = " & currentItem
    Me.Bookmark = Me.RecordsetClone.Bookmark

I was concerned that the location of the active control when the hot key combination was entered might cause the Me keyword not to work, so I have put the form name, but that still doesn't get the hot key combination to work.


What is different about using a hotkey to trigger the code compared to clicking the command button?


Thanks
Carolyn Johnson
St Louis, MO


More information about the AccessD mailing list