>I have a listbox on a form.
>
>ControlSource is ATTS.
>
>RowSource is IIF(atts.EXT="YES",allt(str(atts.seqno))+" "+atts.placed+" via "+atts.route+" Extubated - "+ atts.ext_reas,allt(str(atts.seqno))+" " +atts.placed+" via "+atts.route)
>
>RowSourceType is Fields
>
>The form init and prev and next buttons have this code -
>
>* Find Attempts record that goes with Tube record
>CREATE CURSOR atts;
>(Ext C(3), Seqno N(2), Placed C(18), Route C(10), Ext_Reas C(12))
>
>ATTS_CNT=0
>SELECT attempts
>SCAN FOR attempts.mast_id = tube.mast_id
> SELECT atts
> APPEND BLANK
> REPLACE atts.ext WITH attempts.ext
> REPLACE atts.seqno WITH attempts.seqno
> REPLACE atts.placed WITH attempts.placed
> REPLACE atts.route WITH attempts.route
> REPLACE atts.ext_reas WITH attempts.ext_reas
>
> ATTS_CNT=ATTS_CNT+1
> SELECT attempts
>ENDSCAN
>SELECT tube
>
>
>All I want to know is how to update the listbox contents whenever it changes whether I am on this form or another form and return to this form.
>When I leave the form and add some records to atts and come back to the form it does not update the listbox unless I press Prev or Next button first. Any ideas what's wrong? Is there are better way to do this? I tried THISFORM.lstTube_tries.Requery and DODEFAULT(), but then the listbox refreshes, but other controls on the form disappear. Thanks for the help.
Have you considered using a view like:
CREATE VIEW Atts AS;
SELECT Ext,;
Seqno,;
Placed,;
Route,;
Ext_Reas;
FROM Attempts;
WHERE Attempts.Mast_Id = ?Tube.Mast_id
ATTS_CNT=RECCOUNT("Atts")
I'll bet my bottom $ it'll execute faster.
As you move throgh the Tubes table, a REQUERY("Atts") along with a
.ListBox.Refresh should show you the current values.
BTW, instead of using a listbox why not use a grid? That's after all what it was invented for :-)
Peter Pirker
Whosoever shall not fall by the sword or by famine, shall fall by pestilence, so why bother shaving?
(Woody Allen)