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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Box Item Selected Automatically after Requery 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hi,
I have a problem with list box requery. I use the Requery method to display records for the specified date in a list box. I select an item from the list box and then print it's contents. When I requery the list box for a different date, one of the records retrieved is automatically selected ( highlighted in black). I don't want this to happen. So long as I don't select an item and keep on requerying for different dates, it is fine. If I select an item and then requery for a differnt date, this problem occurs.

Thank in advance.
 
Maybe you could use the SetFocus method.

Try setting the focus after requery to an insignificant item like a button - dont worry, setting focus there won't click it.

ButtonName.setfocus
is the code.

-Josh ------------------
-JPeters
Got a helpful tip for Access Users? Check out and contribute to 'How to Keep Your Databases from becoming Overwhelming!'
thread181-293590
jpeters@guidemail.com
------------------
 
Hi Josh,
I did try setting the focus to another control. But it didn't work. Thanks anyway.

Any solutions anybody? Thanks in advance.
 
If you are happy to leave the focus in the listbox then you could use a combination of the SelStart and SelLength properties for the control. Check them out in Access Help. Just set them both to zero after your requery.
Hope this helps Raymondo
raymondo@rossar.net
 
Hi sdimov,
Your suggestion has solved what was proving to be a great head ache for me. I have given you a star for this star solution. Thanks a lot.
With regards,
PGK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top