I'm not sure where you are getting varItem from.
Do you really need the Multi Select property set to anything other than None? Are you ever going to want to display contacts from more than one customer in your second listbox?
If not, change the multi-select property to None, and replace varItem in your code to me.lst_Customers (or whatever the name of your customers list is).
If so, then I don't think the code you are using now will accomplish that.
Post all of the code in the AfterUpdate event of the list.
BTW, you don't need to requery the list after changing the rowsource. Access automatically does that?
-- HTH Dale
email address is invalid Please reply to newsgroup only.
"Mark" wrote:
[Quoted Text] > Hello. > > Am using Access 2003. The Multi-Select value is set to Extended. > > The event fires - both Click and After Update. But when I use the arrow keys > on the keyboard it returns the previously selected row - the AfterUpdate > event actually fires before the list box selects the next/previous item. > > My SQL statement reads: > > varSQL2 = "SELECT tblContacts.Name, tblContacts.Department, > tblContacts.JobFunction, tblContacts.Phone, tblContacts.Email, > tblContacts.Mobile FROM tblContacts where CustomerID = " & varItem > > lstContacts.RowSource = varSQL2 > lstContacts.Requery > > "Dale Fye" wrote: > > > What version of Access? I'm using 2007, and I put a debug statement in the > > Click and Afterupdate events of the listbox. Both of these events are > > firing, whether I select using the mouse or the up and down arrow keys. And > > both return the same value for the list. > > > > What is the value of the lists "Multi-Select" property (found on the Other > > tab)? > > > > What is the SQL statement you are using for your Contacts list? > > > > -- > > HTH > > Dale > > > > email address is invalid > > Please reply to newsgroup only. > > > > > > > > "Mark" wrote: > > > > > Hi, > > > > > > I have a List Box problem that is driving me insane :-(( > > > > > > I have a List Box that drives a second List Box - classic Customers / > > > Contacts scenario. > > > > > > Works a treat (nearly) - when I select a Customer (using the mouse) it > > > displays the relevant contacts in the second List Box. > > > > > > However, when I use the keyboard up/down arrow key it doesn't work properly > > > - the SQL statement I use brings back the previously selected customer. > > > > > > The code is in the After_Update event of my first List Box - am I using the > > > correct event in the first place?? > > > > > > Mark > > > > > >
|