Re: non-firing Form_Current on new record selected by listbox

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"BBC via AccessMonster.com" <u49322@uwe> wrote in message news:942c2de60af79@xxxxxx
Access 2007 I am selecting records on a form via a listbox. The
Form_Current event fires on opening the form (1st record is selected by
default) and fires on the selection of all records selected via the ListBox
EXCEPT when re-selecting the very first record again (after going to another
record). It DOESN'T fire only when using the the ListBox, using my
navigation buttons always causes the Form_Current to fire on moving to
another record (even going back to the first record).
The ListbBox always selects & diplays the correct record, 1st or otherwise

The code for the ListBox is (using After_Update event)
DoCmd.SearchForRecord , "", acFirst, "[ClientID] = " & Str(Nz(Screen.
ActiveControl, 0))

Typical record navigation code is
DoCmd.GoToRecord , "", acNext

any thoughts or suggestions


I don;t know why that would be, and don't have my A2007 PC turned on at the moment, but you might check if different code for your list-box navigation makes a difference. For example, I would code it this way:

'----- start of example code -----
Private Sub lstYourListbox_AfterUpdate()

With Me.lstYourListbox

If Not IsNull(.Value) Then
Me.Recordset.FindFirst "ClientID=" & .Value
End If
End With

End Sub
'----- end of example code -----

If that code works and doesn't show the misbehavior you report, I would conclude it's some quirk of DoCmd.SearchForRecord, though I haven't heard of that before.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

.



Relevant Pages

  • Re: have problems with divs
    ... You need to set up your forms so that when a user makes a selection or changes a selection ... Each time the script fires, it will then rewrite those items to the table. ... it would only run once as it is witin a HTML file. ... > Your browser does not support inline frames or is currently configured not ...
    (microsoft.public.frontpage.programming)
  • Re: IE automation
    ... Fires when the user aborts the download of an image. ... Fires on the source object before the selection is copied to the system ... Fires on the target element when the user drags the object to a valid drop ...
    (microsoft.public.vc.mfc)
  • Re: how to handle bulk deletion for contacts through code
    ... I told you that if the last item in the collection is removed that ItemRemove may not fire but ItemChange will fire. ... time when you select the selectiononchange event fires. ... selection on change event fires but when there is no records the selection on ...
    (microsoft.public.office.developer.outlook.vba)
  • Re: How to refresh UI immediately?
    ... fires off a process that can take a few seconds to execute. ... found that when you click your selection, ... What you need is something like the SwingWorker class to move the hard work off to an independent thread, then the GUI can get right back to its refresh immediately. ...
    (comp.lang.java.gui)
  • Menustrip strange behavior (.NET2)
    ... pressed allows selection of menu items. ... Releasing left button over an item ... fires the clicked event. ...
    (microsoft.public.dotnet.framework.windowsforms.controls)