Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data being replaced during requery on List Box

Status
Not open for further replies.

tsosiel

Programmer
Aug 10, 2001
42
US
I have a form in my database that is bounded to a table (tblApps). The header on this form has two controls where users enter data and then press a command button (cmdSubmit)to filter the form to populate controls in the form's detail area. One of these controls is a listbox which has a rowsource of
SELECT tblApps.Title, tblApps.Description, tblApps.AppID FROM tblApps WHERE (((tblApps.CSCIID)=[txtCSCI]) AND ((tblApps.DropID)=[cboDrop]));
With Column widths of 3.5";0";0".

When the cmdSubmit button is pressed, the following is done:
1) create the criteria for filter
2) apply criteria to form (filter table)
3) requery listbox

Now, when there is data in the listbox and after clicking the entries in the box, I then hit the cmdSubmit button again. Whatever item was selected last ALWAYS replaces the first record of the list box! I'm using Me.lstApps.Requery to refresh the listbox. I even tried Me.Refresh to refresh the form - same results! I have a Dynaset Recordset for the form.

I'm at wits end to correct this problem... ANY SUGGESTION is appreciated and welcomed! Thank you in advance.

Lorentz!
 
After battling this issue, I found a fix! Before I set my form to the filter that is created, I set the value of the listbox to old value:
lstApps.Value = lstApps.OldValue

It seems to work! If anyone has another method, please let me know. Thanks!

Lorentz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top