473,326 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

query records only from 21 days after last date visited

229 100+
Hi, I have an access database with multiple users each with a unique profileid. Each has a last visited field in the database called "last visit" with the date stored like this. 02/07/2009 22:50:19

I want only those users to appear on my page, for three weeks, after the date that they last visited.

If anyone has any ideas that would be great.
Thanks
Richard
Jul 16 '09 #1
4 2092
jhardman
3,406 Expert 2GB
Expand|Select|Wrap|Line Numbers
  1. select * from profiles WHERE datediff(d, [last visit], getdate()) < 21
I can't remember which direction this subtracts, it might need >21

Jared
Jul 17 '09 #2
fran7
229 100+
Dear Jared, Thanks for that. I tried it but got an error Undefined function 'getdate' in expression.
I then looked around and it seems access is not compatable with 'getdate'
so I tried datediff(d, [latestvisit], " & now() & " < 21
that seems to return todays date and time but I get an error (missing operator) in query expression at the expression. I tried now()) but the error is then on the second )
Thanks if you have any ideas.
Richard
Jul 17 '09 #3
fran7
229 100+
Hi, I think it might be
datediff('d', [latestvisit], now()) < 21

Tested a bit and it seems to work.
Thanks very much for your great help.
Richard
Jul 17 '09 #4
jhardman
3,406 Expert 2GB
@fran7
Glad you got it working. It's true, I switched away from access several years ago. I looked it up and it seems the access equivalent to "getdate" is just "date()", but if "now()" works as well, then I guess you are set.

Jared
Jul 21 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Si | last post by:
Hi there. I have a page on a website I am building where is want to look for all records added in the last 60 days. The date is added in short UK format, that is 25/12/2003 in an access...
6
by: carverk | last post by:
Hello All I'm in the middle of moving a MS Access DB to a MySql backend. I have figured out about 90% of the problems I have faced, execpt for this one. I have 3 Queries, which pull records...
6
by: Ike | last post by:
How can I make a query such that in the "WHERE" part of my clause, I want to put something to the effect that, say, X days have elapsed since a given date. For example, suppose in my table, I have...
2
by: Willem | last post by:
Hi there, I'm sort of new with doing much record manipulation with queries. Up till now I've been programming VBA and doing record looping to get my results. This works fine but tends to get...
0
by: Scott Morford | last post by:
This is a followup to a question I posed last summer. http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=utf-8&selm=3f451dd4%240%241095%247f8943f3%40newsreader.visi.com I'm developing a weed...
4
by: C White | last post by:
Hi I am having problems with running a query that does the following there are 5 fields in a table that the query is based on, the first four are simple enough and all that happens is that the...
11
by: Andy_Khosravi | last post by:
My problem: I'm having trouble with a query taking much too long to run; a query without any criteria evaluating only 650 records takes over 300 seconds to run (over the network. On local drive...
5
by: Wired Hosting News | last post by:
I tried to be breif and give a scenario so as not to be overlooked because it was soooo long. Let me give you real world. I am a manufacturer of goods and produce 11 items that are distributed...
2
by: Dinesh | last post by:
Hi experts, I am working on SQL Server 2005. Now i have to write a query which will extract some information from a table. My main table is having few columns supose 3 columns. EmpID ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.