Find Button

  • Thread starter Thread starter duckslikejello
  • Start date Start date
D

duckslikejello

I made the one in the command button's wizard but what i need is fo
it to be simple. I am trying to get where someone can enter a
account number and it'll go to that record. With the find button
you have to click the control and then hit find and its got too man
conditions

Thank
 
You can place an unbound text box on your form where the user can enter the
number to find. Use its AfterUpdate event to move to that record.

For an example of the code, see:
Using a Combo Box to Find Records
at:
http://allenbrowne.com/ser-03.html
Although the article explains how to set up a combo box, you can use the
same approach with a text box.
 
duckslikejello said:
what is Dim rs as DAO.Recordset

If you are referreing to the first line of code in this article:
http://allenbrowne.com/ser-03.html
the idea is to set the AfterUpdate property of the control to:
[Event Procedure]
Then click the build button (...) beside this.
Access opens the code window.
The code goes ino between the "Sub" and "End Sub" lines.

You will need some understanding of VBA code to be able to adapt this to
your needs.
 
On Mon, 18 Jul 2005 15:35:09 -0500,
I made the one in the command button's wizard but what i need is for
it to be simple. I am trying to get where someone can enter an
account number and it'll go to that record. With the find button,
you have to click the control and then hit find and its got too many
conditions.

Thanks

Use a Combo Box, using the combo box wizard "use this combo to find a
record".

The user types the account number - or the start of it, if there's
only one with matching first few characters it will autofill - and
presses the Enter key. No buttons, no mouse clicks, just type and
press the enter key.

John W. Vinson[MVP]
 
Thanks, its not what I was picturing but it gets the job done

Also...when I exit the form, it gives me a message for this line o
code

rs.FindFirst " = " & Str(Me![Combo102]
 
You can try this way and it might be more of what you were imagining:
Make 1 unbound text box and a list box that finds a record on the form
(3rd option if you use the wizard). Set the rowsource of the list box
to this when the cmdbutton of your search is clicked:

[listbox].RowSource = "SELECT [Table1].[Account #], [Table1].[Any other
field you want to show in the list box]
(include any # of these depending what you want to show in the list
box)
FROM [Table1] WHERE ((([Table1].[Account #]) Like " & "'" & [textbox
you type in] & "'" & ")) ORDER BY [Table1].[Account #];"

This will put all records in the list box that it finds has in common
with the text box. From here, click on the listbox and your form
should populate with whatever record you just clicked on.
 
Thanks

The option to add another column to the listbox was very helpful.
wasn't thinking of that at the time, but that will really help

I am getting a syntax error (missing operator) in this part

WHERE ((([Warrenty Log]. Like " & "'" & [Text114
& "'" & ")) ORDER BY [Warrenty Log].[intAcct];

THanks agai
 
On Fri, 22 Jul 2005 11:34:40 -0500,
Thanks!

The option to add another column to the listbox was very helpful. I
wasn't thinking of that at the time, but that will really help.

I am getting a syntax error (missing operator) in this part:

WHERE ((([Warrenty Log]. Like " & "'" & [Text114]
& "'" & ")) ORDER BY [Warrenty Log].[intAcct];"

THanks again

You've got a missing fieldname. If Warrenty Log is a table, then you
need to be searching to find a record by comparing some field in
WarrentyLog with the text value in Text114. I don't know which field
that would be, but put its name in brackets immediately after the
period following [Warrenty Log].

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top