From: The Frog on 31 Mar 2010 05:31 Alrighty then......... Form is rebuilt. Events are working. Setting the keycode = 0 at the end if each desired keydown event option stops the subform getting the focus. Final code as an example for the cursor down key on the KeyDown event is as follows: If lstProduct.ListCount = 0 Then Exit Sub If lstProduct.ListIndex >= lstProduct.ListCount - 1 Then Exit Sub lstProduct.Selected(lstProduct.ListIndex + 1) = True lstProduct.Value = lstProduct.Column(lstProduct.BoundColumn - 1, lstProduct.ListIndex) txtProduct.SetFocus txtProduct.Value = lstProduct.Column(0, lstProduct.ListIndex) KeyCode = 0 Works perfectly Thankyou for your help. I would never have guessed the keycode = 0 thing. It was also necessary to set the value property of the listbox in the code so that the subform updated automatically (if anyone is interested). If I didnt set this the subform didnt show the related records. Thankyou for all your help, I really appreciate it. Cheers The Frog
From: Stuart McCall on 31 Mar 2010 07:15 "The Frog" <mr.frog.to.you(a)googlemail.com> wrote in message news:bdd5e25f-3e1b-45f3-b198-13d3ae77eae4(a)z4g2000yqa.googlegroups.com... > Alrighty then......... > > Form is rebuilt. Events are working. Setting the keycode = 0 at the > end if each desired keydown event option stops the subform getting the > focus. Final code as an example for the cursor down key on the KeyDown > event is as follows: > > If lstProduct.ListCount = 0 Then Exit Sub > If lstProduct.ListIndex >= lstProduct.ListCount - 1 Then Exit > Sub > lstProduct.Selected(lstProduct.ListIndex + 1) = True > lstProduct.Value = lstProduct.Column(lstProduct.BoundColumn - > 1, lstProduct.ListIndex) > txtProduct.SetFocus > txtProduct.Value = lstProduct.Column(0, lstProduct.ListIndex) > KeyCode = 0 > > Works perfectly > > Thankyou for your help. I would never have guessed the keycode = 0 > thing. It was also necessary to set the value property of the listbox > in the code so that the subform updated automatically (if anyone is > interested). If I didnt set this the subform didnt show the related > records. > > Thankyou for all your help, I really appreciate it. > > Cheers > > The Frog You're very welcome. Ah. a corrupt form. That certainly wouldn't help! The reason I was able to guess re the KeyCode thing is because I can say 'been there, done that' (and now so can you). :-) I suspect you've done a lot of work/re-work on that form. That's when Access mucks it up, usually. So I routinely do: Application.SaveAsText Delete the form Application.LoadFromText every now and then, whether the form is acting strangely or not. Works for me.. Glad you're up & running.
First
|
Prev
|
Pages: 1 2 Prev: Macro to update column headers in table Next: My database window objects became hyperlinks |