Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: emulating the 'Help Topics' box in Access


Message #1 by "Mike" <mike.day@o...> on Thu, 19 Sep 2002 15:12:22
Hi, 
i have created a form with a text box and list box loosely based aroung the 
help toplics form in access. ie filters down the search when you key in.
the listbox rowsource is based on a qry which populates the box fromm the 
parameter provided in the text box.

I would like it to amend the rowsouce every time a character is added in 
the textbox- ie filtering the results as in the access help box.

i have tried adding the code behind all of the events for the text box- and 
i can't quite emulate what the access help does.

any ideas?
cheers
Message #2 by "Wesley Kendrick" <wez.k@n...> on Thu, 19 Sep 2002 17:19:28 +0100
Hi Mike, you can use this in the textbox After Update event procedure

DoCmd.Requery "YourListBoxQuery"

However, AfterUpdate occurs when you leave the field, not imediately after
typing a character.

Hope this helps,

Wesley Kendrick

----- Original Message -----
From: "Mike" <mike.day@o...>
To: "Access" <access@p...>
Sent: Thursday, September 19, 2002 3:12 PM
Subject: [access] emulating the 'Help Topics' box in Access


> Hi,
> i have created a form with a text box and list box loosely based aroung
the
> help toplics form in access. ie filters down the search when you key in.
> the listbox rowsource is based on a qry which populates the box fromm the
> parameter provided in the text box.
>
> I would like it to amend the rowsouce every time a character is added in
> the textbox- ie filtering the results as in the access help box.
>
> i have tried adding the code behind all of the events for the text box-
and
> i can't quite emulate what the access help does.
>
> any ideas?
> cheers
>

Message #3 by "Steven White" <Steve.White@m...> on Fri, 20 Sep 2002 00:58:31
Rather than After Update, you might want to use On Key Down

If you don't want it to have it requery when you press tab or enter, you could always write the 
procedure something like:

Private Sub txtYourField_KeyDown(KeyCode As Integer, Shift As Integer)
On Error GoTo finish
If Shift <> 1 And (KeyCode = 13 Or KeyCode = 9) Then
DoCmd.Requery
End If
finish:
Exit Sub

End Sub



Keycode 13 is the code for <Enter>
Keycode 9 is the code for <Tab>

You might want to get rid of the Shift<>1 bit, that's just something I usually put in case the 
user wants to go back a field, rather than forward.

KeyDown really is an excellent event - it can do Soooo much, yet it's so simple

Steven

  Return to Index