Share via

SearchForRecord does NOT trigger OnCurrent Form Event

Anonymous
2010-11-10T18:20:40+00:00

Why does the wizard use this Macro action? It does not trigger the Form's OnCurrent Event.


Dweezil38

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. Anonymous
    2010-11-16T19:04:44+00:00

    Don't use 2007 nor Macros, but the native Find function in Access does nothing if the pointer already points at the record being searched for. If you're on a record with a control's value being 'hemidemisemiquaver,' and this value is unique to that record, and you try to search for it, Access will report it as not being found, even though you're staring at it. My guess is that if you open the form, goto a new record but enter nothing and then use the search function, the pointer is still pointing at the first record that appears in the recordset, hence the commands in Form_Current don't execute. 


    There's always more than one way to skin a cat!

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-11-16T18:39:05+00:00

    Nathan

    The OnCurrent event of the form is used to determine if I'm on a NEWRECORD position. If I am, I display a Label that tells the user they are on a New Record position otherwise I make this label invisible. With the OnCurrent Event not being triggered, if I go to a New Record Position then use the Search Combo box and locate the first record of the form's recordsource, my "NEW RECORD" label does not get set to visible = false, because the OnCurrent event doesn't get triggered.

    In either case, the OnCurrent event of a form should trigger each and every time the user moves off the current record, no matter how that action occurs, be it via macro "SearchForRecord" or VBA code.

    Dweezil


    Dweezil38

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2010-11-16T17:27:55+00:00

    Is there a resaon you are using the OnCurrent event?  What happens if you switch to a different event, such as the After Update event of the combo box?

    Best Regards,

    Nathan Ost

    Microsoft Online Community Support


    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2010-11-16T14:25:12+00:00

    Hello Nathan

    If I create a combo box, that is used to find a record, in my Data Entry Form, the wizard that creates this combo, uses the macro action "SearchForRecord". If I place an Event Procedure in the OnCurrent Event of the form, the event does not get triggered when searching and finding the first record in the Form's Recordsource. It will work when searching and finding any other record but not the first record???? Same is true if you convert the macro to an event procedure which will give the VBA command of :

    "DoCmd.SearchForRecord , "", acFirst, "[EmployeeID] = " & Str(Nz(Screen.ActiveControl, 0))"

    Any other record but finding the first will trigger tthe OnCurrent Event.

    Thanks Dweezil


    Dweezil38

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2010-11-15T16:30:36+00:00

    Hi Dweezil38,

    What wizard are you referring to? If you could provide a bit more information on what you are trying to do and the exact steps you are currently using to try and accomplish this, that may help me or someone else on the forum provide you with the information you are looking for. I have also provided an article below that provides some information on the SearchForRecord macro action.

    SearchForRecord Macro Action -http://office.microsoft.com/en-us/access-help/searchforrecord-macro-action-HA001226458.aspx

    Best Regards,

    Nathan Ost

    Microsoft Online Community Support


    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Was this answer helpful?

    0 comments No comments