Creating a SEARCH BUTTON

  • Thread starter Newf via AccessMonster.com
  • Start date
N

Newf via AccessMonster.com

I am having trouble knowing how to and where to start to make a SEARCH BUTTON.
The search button the wizzard gives me is not what I need. I need to search
either Query or Tables for a certian field on the form.

The search field is: frm_txt_Return_Number ("AR"999999) - this field is bound.
Do I need to use and an unbound field?

What I need to be done after the search is to bring up all the fields that is
with this frm_txt_Return_Number. If the search brings up nothing i need a msg
to say, "Would you like to...."

I HOPE someone can help me out.

Thanks

cw
 
B

benyod79 via AccessMonster.com

Why not just create a sub-form that's record source is what you're trying to
search for?
 
B

benyod79 via AccessMonster.com

If you go the sub-form route, maybe you could make the sub-form not visible.
Then use the DCOUNT() function to see if there are any records matching your
criteria and, if so, make the sub-form visible. That way you don't see the
sub-form unless there's something there to see. And that will also allow you
to use msgbox to prompt the user for "Would you like to....". If vbYes, then
whatever you want to do. If vbNo, then whatever you want to do.

Hope that makes sense.
 
N

Newf via AccessMonster.com

Benyod:
All what you say sound great but I am a 'newbie' and have no idea where to
start and what to write for the code.

Newf
If you go the sub-form route, maybe you could make the sub-form not visible.
Then use the DCOUNT() function to see if there are any records matching your
criteria and, if so, make the sub-form visible. That way you don't see the
sub-form unless there's something there to see. And that will also allow you
to use msgbox to prompt the user for "Would you like to....". If vbYes, then
whatever you want to do. If vbNo, then whatever you want to do.

Hope that makes sense.
I am having trouble knowing how to and where to start to make a SEARCH BUTTON.
The search button the wizzard gives me is not what I need. I need to search
[quoted text clipped - 12 lines]
 
B

benyod79 via AccessMonster.com

My suggestion would be to play around with queries to find out how they work.
A form's record source is nothing more than a query which limits the data
contents of the form. Since you have some table that contains the data
"AR999999". When you create a query based on that table put: = "AR999999" in
the criteria section under the field that would contain it and it will only
show the records that are exactly AR999999. You'll have to do some searching
in the help file for more examples, but that's the basic concept of querying.

Once you have that down, you can create a form and make a subform within that
form. The subform will use criteria similar to what I wrote above except it's
recordsource criteria will be something like:
=[Forms]![frm_yourform].[frm_txt_Return_Number]
As you can see, whatever the value of "frm_txt_Return_Number" is, the subform
will show only those records matching that value. (I believe, haven't done it
in a while, but the create a subform wizard might allow you to pair up the
values)

Hope this helps you get started.

Words of advice: Play around with queries and forms as much as possible to
understand how they work and what data they show.
Benyod:
All what you say sound great but I am a 'newbie' and have no idea where to
start and what to write for the code.

Newf
If you go the sub-form route, maybe you could make the sub-form not visible.
Then use the DCOUNT() function to see if there are any records matching your
[quoted text clipped - 10 lines]
 
Top