A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

like operator



 
 
Thread Tools Display Modes
  #1  
Old May 5th, 2005, 05:25 PM
seth
external usenet poster
 
Posts: n/a
Default like operator

i'm learning more about queries and understand how to use text as part of a
phrase using * and how to use like operator and using [ ] to prompt for
input. is there anyway to combine it?

what i wanted to attempt is to prompt for input, and use like operator to
find whatever what put in in that field.

for example, if i have a date/time field (unfortunately both are in the same
field) i want to prompt for the date, but query everything that it contains.
so if the field is 5/5/2005 12:00:00 i want to be able to just type 5/5/2005
when running the query and show all records that contain that text, no
matter what time follows it.

is this possible?
or is there a way to get around it?
tia


  #2  
Old May 5th, 2005, 05:53 PM
ngan
external usenet poster
 
Posts: n/a
Default

Try the Format function....Format(fieldname, "Short Date")...look up the
format function in your module help section.

"seth" wrote:

i'm learning more about queries and understand how to use text as part of a
phrase using * and how to use like operator and using [ ] to prompt for
input. is there anyway to combine it?

what i wanted to attempt is to prompt for input, and use like operator to
find whatever what put in in that field.

for example, if i have a date/time field (unfortunately both are in the same
field) i want to prompt for the date, but query everything that it contains.
so if the field is 5/5/2005 12:00:00 i want to be able to just type 5/5/2005
when running the query and show all records that contain that text, no
matter what time follows it.

is this possible?
or is there a way to get around it?
tia



  #3  
Old May 5th, 2005, 07:32 PM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Thu, 5 May 2005 12:25:02 -0400, "seth" wrote:

i'm learning more about queries and understand how to use text as part of a
phrase using * and how to use like operator and using [ ] to prompt for
input. is there anyway to combine it?

what i wanted to attempt is to prompt for input, and use like operator to
find whatever what put in in that field.


Use

LIKE "*" & [Enter term:] & "*"

on the criteria line.

for example, if i have a date/time field (unfortunately both are in the same
field) i want to prompt for the date, but query everything that it contains.
so if the field is 5/5/2005 12:00:00 i want to be able to just type 5/5/2005
when running the query and show all records that contain that text, no
matter what time follows it.


The above advice applies to TEXT fields (it's still useful there
though so I'm leaving it in!) but a date/time field *IS NOT TEXT*.
Internally, it's stored as a Double Float count of days and fractions
of a day (times) since midnight, December 30, 1899.

To get all records for a given day, regardless of the time, you can
use a criterion

= [Enter date:] AND DateAdd("d", 1, [Enter date:])


Access will only prompt you once if the parameter is exactly the same
in both instances.

John W. Vinson[MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
like operator seth General Discussion 2 May 5th, 2005 07:32 PM
How to make the Operator a Variable? CaptainMyCaptain Running & Setting Up Queries 1 October 20th, 2004 03:05 PM
In operator question Tony Running & Setting Up Queries 3 September 22nd, 2004 03:57 AM
Missing Operator Problem Benjamin Running & Setting Up Queries 4 August 26th, 2004 01:34 PM
me operator Marc Worksheet Functions 4 March 18th, 2004 12:27 PM


All times are GMT +1. The time now is 08:35 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.