| | |
|
|
|
Re: Doing a query based on input from user |
| message from Taffy-Taff on 6 May 2004 |
Thanks for the assistance. I obviously did not fully express what I
I have a form that is populated with information based on a filtered
table. The query to filter the table is working fine. The form is now
populated with the first record in the filtered table. What I want to
do is to put a textbox on the form (called GetAnAccount). When the
person enters a specific account # and press ENTER, I want the form to
be populated with the data for that specific record. Can you assist
with how to have this done?
Thanks much.
Taffy
|
| Nikos Yannacopoulos replied to Taffy-Taff on 7 May 2004 |
Taffy,
You can use an event like On Exit, On Lost Focus, After Update of the
GetAnAccount txtbox, so it will fire when the user hits enter. Not my
preferred solution, though, I would prefer a command button instead, so as
not to pass on focus to another control or even the next record. At any
rate, the code run by the event would be something like:
DoCmd.ApplyFilter , "AcctNo=" & Me.GetAnAccount
where I have assumed that the field name is AcctNo, change to the actual
field name.
HTH,
Nikos
"Taffy-Taff" <Taffy-Taff.15vdm8@nospam.MSAccessForum.com> wrote in message
news:Taffy-Taff.15vdm8@nospam.MSAccessForum.com...
|
| Taffy-Taff replied to Nikos Yannacopoulos on 13 May 2004 |
Thanks guys, it works fine.
|
| Larry Daugherty replied to Taffy-Taff on 7 May 2004 |
Hi Taffy,
I suggest a command button (cmdGetAccount?) located, say, just to the right
of the textbox. I'd probably make its caption" &Get Account ". Using a
command button rather than counting on the ENTER key will remove
ambiguities.
Look in Access Help for GoToRecord. complete the where clause for the field
in your table matching the value of the text box with the account number.
Place that code in the Click event of cmdGetAccount.
HTH
|
|
Archived message: Re: Doing a query based on input from user (MS Access Database)