Running query for invoices that start with #5???

  • Thread starter mugziegumz via AccessMonster.com
  • Start date
M

mugziegumz via AccessMonster.com

How do I create a query that will look up multiple invoices that start with
the number 5? When I type in criteria "5" nothing shows up even though I know
I have plenty.....thanks.
Shannon
 
M

Marshall Barton

mugziegumz said:
How do I create a query that will look up multiple invoices that start with
the number 5? When I type in criteria "5" nothing shows up even though I know
I have plenty


What type of field contains these invoice numbers?

If it's an Integer or Long field, then you can use the
criteria:
Like "5*"

If it's a Text field, you can try the same thing unless the
field has leading spaces, zeros, or something else.
 
M

mugziegumz via AccessMonster.com

Thank you so much. Exactly what I needed. Being brand new with access is
tough!
 
M

mugziegumz via AccessMonster.com

One more question...
Here are examples of invoices:
11595550
145390
18375
2101931
212864
5g8509
5g8886
All invoice are sporadic. If I wanted to create a query and save it to go
into whenever and do a search for all invoices with a 1, or all invoices that
start with G...how do I create a query where it is simple to open it, type in
what I'm looking for and get the details. Or do I have to go in to the query
each time, click design button and change my search to whatever I'm looking
for?
Thank you so much. Exactly what I needed. Being brand new with access is
tough!
[quoted text clipped - 8 lines]
If it's a Text field, you can try the same thing unless the
field has leading spaces, zeros, or something else.
 
M

Marshall Barton

mugziegumz said:
One more question...
Here are examples of invoices:
11595550
145390
18375
2101931
212864
5g8509
5g8886
All invoice are sporadic. If I wanted to create a query and save it to go
into whenever and do a search for all invoices with a 1, or all invoices that
start with G...how do I create a query where it is simple to open it, type in
what I'm looking for and get the details. Or do I have to go in to the query
each time, click design button and change my search to whatever I'm looking
for?


A quick and dirty way is to set the criteia to:
Like [Enter first character] & "*"

A better way would be to create a form with a text box where
you can enter the first character and a button to open the
query (the button wizard can create the code for you). In
this case the criteria would be:
Like Forms![form name].[text box name] & "*"

An even better way is avoid displaying a query (where users,
including yourself, can easily mutilate the data) by using a
continuous form to display the records. In this scenario,
the text box would be in the form's header section and the
criteria could be either as in the second scenario. Since
this does not use a button, you woll need a line of code in
the text box's AfterUpdate event procedure:
Me.Requery
 
M

Mike Painter

Marshall said:
mugziegumz said:
One more question...
Here are examples of invoices:
11595550
145390
18375
2101931
212864
5g8509
5g8886
All invoice are sporadic. If I wanted to create a query and save it
to go into whenever and do a search for all invoices with a 1, or
all invoices that start with G...how do I create a query where it is
simple to open it, type in what I'm looking for and get the details.
Or do I have to go in to the query each time, click design button
and change my search to whatever I'm looking for?


A quick and dirty way is to set the criteia to:
Like [Enter first character] & "*"

A better way would be to create a form with a text box where
you can enter the first character and a button to open the
query (the button wizard can create the code for you). In
this case the criteria would be:
Like Forms![form name].[text box name] & "*"

An even better way is avoid displaying a query (where users,
including yourself, can easily mutilate the data) by using a
continuous form to display the records. In this scenario,
the text box would be in the form's header section and the
criteria could be either as in the second scenario. Since
this does not use a button, you woll need a line of code in
the text box's AfterUpdate event procedure:
Me.Requery

This does not answer the question you asked but a combo box sorted on teh
invoice number would allow this.
 
M

mugziegumz via AccessMonster.com

So if I had 3,000 invoices and wanted to find all starting with a 5.......how
is a combo box useful?

Mike said:
[quoted text clipped - 29 lines]
the text box's AfterUpdate event procedure:
Me.Requery

This does not answer the question you asked but a combo box sorted on teh
invoice number would allow this.
 
M

mugziegumz via AccessMonster.com

I figured it out. This is what I wanted. Thank you Marshall Barton. The first
command worked perfect.

Marshall said:
One more question...
Here are examples of invoices:
[quoted text clipped - 11 lines]
each time, click design button and change my search to whatever I'm looking
for?

A quick and dirty way is to set the criteia to:
Like [Enter first character] & "*"

A better way would be to create a form with a text box where
you can enter the first character and a button to open the
query (the button wizard can create the code for you). In
this case the criteria would be:
Like Forms![form name].[text box name] & "*"

An even better way is avoid displaying a query (where users,
including yourself, can easily mutilate the data) by using a
continuous form to display the records. In this scenario,
the text box would be in the form's header section and the
criteria could be either as in the second scenario. Since
this does not use a button, you woll need a line of code in
the text box's AfterUpdate event procedure:
Me.Requery
 

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

Top