View Full Version : Creating a search command


Steve67
10-04-2007, 08:14 AM
I have a table that was set up from a parameter query. Before the form opens it ask you for a part number. You type in the part number you want the information for and the form pops up to that particular part number. The problem that I am having is that if I want to move to another part number I have to close out the form and reopen it to type in another part number. I tried using the Access Find/Replace feature to do a search for a another part number to open up the information to that part number and I have even tried to create a command function that will do a search, but when I use them they both come up with no records found.

Is there a way to make a search function in a form created from a parameter query? I am not a script writer and am just really getting indepth with Access at the moment.

Thanks
Steve

ajetrumpet
10-04-2007, 08:28 AM
The problem that I am having is that if I want to move to another part number I have to close out the form and reopen it to type in another part number.Is there a way to make a search function in a form created from a parameter query?Sure there is. Just put a button on the form that will allow you to enter the new value and refilter the form....Private Sub button_OnClick

me.requery

End Sub

Steve67
10-04-2007, 10:04 AM
That did the job and an easy solution... thanks a lot. But I have a problem when I try to cancel the operation. I get a visual basic error

"Run-time error 2001"

You cancelled the previous operation

Steve67
10-04-2007, 10:08 AM
Never mind.. I figure out what the problem was.. thanks a lot once again