Requery only once in the OnCurrent event

G

Guest

Is there a way to run a query only once in the onCurrent event. When I load a
new patient up the prior pt's data is still there until I click on a lstBox
where I have that patients visit history by date and visit type. Everytime I
load a new pt to my main form(frmPtDemographics) I need the sub
form(frmVisit) to requery the underling query that populates the patient data
in the sub form and the lstBox on the form. If I put me.requery in the
onCurrent event it just loops. It works correctly on the initial load of the
form. But when I select a new pt through a search form the data sometimes
loads correctly and sometimes not.

So I thought if I requery it would load the correct pt data to the form.
Me.refresh in the current event does not do it.

Any help would be greatly appreciated. Thanks, Rob
 
M

Mark A. Sam

Something seems unstandard here. If your subform is link to the mainform
using the LinkChildField and LinkMasterField properties, it will
automatically requery when you move to a new record on the main form (that
is when the current event fires). If you aren't linked this way, decribe
your setup.

The best thing to do for a listbox is to requery it directly like when a
value in a textbox is update. The controlsource of the textbox would be a
field in the listbox. So in the AfterUpdate event of the control, you would
say, [myLstBox].Requery.

God Bless,

Mark A. Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top