By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,651 Members | 1,694 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,651 IT Pros & Developers. It's quick & easy.

Basic Date Function, Need Help

P: 5
Hi guys, this is gonna sound very simple but got a slight problem with the critera of one of my database's.


Basically i am looking to have a criteria in a Query that returns all the database fields that are 7 days old or less. Before i was using ">Date()-7" but since it turned September it's no longer working at it wont show any of the September database entries only the August ones that are still within the 7 day gap, ie. 29th, 30th and 31st August but nothing from September.

Anyone got any ideas how to fix this?

Thanks
Sep 4 '06 #1
Share this Question
Share on Google+
9 Replies


PEB
Expert 100+
P: 1,418
PEB
You can try:

> int(Now()) - 7

:)
Sep 4 '06 #2

PEB
Expert 100+
P: 1,418
PEB
Or

>Cvdate(Date())-7

or

>Cvdate(str(Date()))-7

Hope that it will work!
Sep 4 '06 #3

P: 5
Tried both and they didn't work, i looked at it in more depth in my database and basically it turns out the Database i have has been adding the automatic dates for September in a different manner than August.

Before it was adding the dates in the format dd/mm/year, now its adding the dates in the format for mm/dd/year.

i use the Date$() for the default value in my date field so it automatically adds the date when i add a new record via my Access Page, is there anyway to change access so that it adds the new dates in the UK format instead of the US format?
Sep 4 '06 #4

PEB
Expert 100+
P: 1,418
PEB
Yes, it can be a reason for this!

But is your Date stored as a Date field or in a text field?

It seems that your date is stored in a text field! This explains why the previous functions doesn't work!

So to store your Date in a convenient Format
do the follow:

Format(Now(),"dd/mm/yyyy") when you put your date stamp

:)
Sep 4 '06 #5

P: 5
Fantiastic that did the trick, thanks a ton PEB :D

Oh by the way i was wondering if maybe you have a suggestion about this other problem i have.

Like i said before i use a Data Access page to add new infomration to my database, its very simple its for adding and recording phone messages. The page itself is a database view it lists all records, took a screen dump so you could see what i mean:

Click Here

My problem is everytime i add a new record it does it from the bottom and it means anyone that access's the page has to scroll alll the way to the bottom, which is just annoying more than anything else to be honest.

I was wondering if there is any way to change this so it adds new records from the Top of the page, or maybe possible to have 2 sections one for new data input and another for listing all the old messages?

Any help you can provide would be brilliant!!

Thanks :D
Sep 4 '06 #6

PEB
Expert 100+
P: 1,418
PEB
If you have an id of the calls, the latest calls will be with the biggest numbers!

If you can sort descending the column of id maybe You will have the new messages on the top!
;)
Sep 4 '06 #7

P: 5
Yeah tried that before just put the the criteria for the ID on the query in decending order and it lists all the records from newest at the top to oldest at the bottom.

Problem is when it does this and i try adding new record, it adds the new empty feilds at the very very bottom of the datalist so the user has to scroll alll the way to the bottom of the page to fill in the blank fields.

Click Here

Any way to make it put up the new blank fileds for entry at the top of the Page? i know you can do something similar in a Form like have the Header section have a kinda data entry area then have the Footer contain a repeating list of all the data in the query, but in the Data Access Page it only lets you have one area with Bound fields so cant do that :(
Sep 4 '06 #8

PEB
Expert 100+
P: 1,418
PEB
Ok!

It's true that I've never worked with data access pages but if you canmodify the page property Data entry when clicking on addNew???

Or if it's immpossible on Addnew you can open a page designed only for data entry and not to show an information???

Have a nice luck!
Sep 4 '06 #9

P: 5
Could easily create a new page for Data entry only yeah but id love something that does both lol.

I aint no expert on access pages myself to be honest, just a basic understanding so struggling with them too :( If there is a way to modify the addNew function so that it adds the new blank entry fields at the top of the page instead of the bottom that would be perfect.
Problem is i have no idea to do it lol, i used the function wizard to create the add new record button on my page so any idea on how i could modify it to add new records would be awesome. :)
Sep 4 '06 #10

Post your reply

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