473,387 Members | 1,456 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,387 software developers and data experts.

Gains loss report help with access

I'm new to this Forum and to Microsoft Access, so that being said I'm sure this is an easy fix.

I am making a database for my unit and I am stuck on my gains loss reports. I've tried using the code below but, i only get results that are within 30 days but the year doesn't matter. I need the results to take in to cout the year also. for example:

right now I put in the code looking for dates of loss with in the next 30 days, my results would enclude:
29 Jan 1985
03 Feb 2007
12 Feb 2002

where all i want is to show the dates in the next 30 days: 03 Feb 2007

eventually I want to have reports that will do 30, 60, 90, 120 days till loss. but I should be able to figure it out if you help me with the 30 days.

heres the code i am working with. thanks in advance for your help.

Expand|Select|Wrap|Line Numbers
  1.  ((([DEROS]+((Int((Now()-[DEROS])/365.25)+1)*365.25)) Between Now() And Now()+30)) 
Jan 28 '07 #1
10 1666
willakawill
1,646 1GB
Hi, take a look at DateDiff()
Jan 28 '07 #2
ADezii
8,834 Expert 8TB
I'm new to this Forum and to Microsoft Access, so that being said I'm sure this is an easy fix.

I am making a database for my unit and I am stuck on my gains loss reports. I've tried using the code below but, i only get results that are within 30 days but the year doesn't matter. I need the results to take in to cout the year also. for example:

right now I put in the code looking for dates of loss with in the next 30 days, my results would enclude:
29 Jan 1985
03 Feb 2007
12 Feb 2002

where all i want is to show the dates in the next 30 days: 03 Feb 2007

eventually I want to have reports that will do 30, 60, 90, 120 days till loss. but I should be able to figure it out if you help me with the 30 days.

heres the code i am working with. thanks in advance for your help.

Expand|Select|Wrap|Line Numbers
  1.  ((([DEROS]+((Int((Now()-[DEROS])/365.25)+1)*365.25)) Between Now() And Now()+30)) 
The Year doesn't matter because your Date Field is probably defined as Text rather than Date/Time. Make the Data Type conversion, and you should be OK.
Jan 28 '07 #3
I looked at DATEDIFF and am still having some trouble. Actually think I confused myself more. thanks for the help though. :)
Jan 28 '07 #4
The Year doesn't matter because your Date Field is probably defined as Text rather than Date/Time. Make the Data Type conversion, and you should be OK.
The date Field is defined as Date/Time, and it is still giving me the same results.
Jan 28 '07 #5
NeoPa
32,556 Expert Mod 16PB
Two suggestions :
  1. Use Date() rather than Now() for predictable results.
  2. Take the code you use to determine the date (It refers to various items not explained here so don't expect us to understand what you're trying to do) and put it in a SELECT statement.
    See what format it comes out in. Is it a Date/Time value or a string or maybe even a numeric.
    When this is sorted out you'll be in a better position to use it properly.
Jan 29 '07 #6
Two suggestions :
  1. Use Date() rather than Now() for predictable results.
  2. Take the code you use to determine the date (It refers to various items not explained here so don't expect us to understand what you're trying to do) and put it in a SELECT statement.
    See what format it comes out in. Is it a Date/Time value or a string or maybe even a numeric.
    When this is sorted out you'll be in a better position to use it properly.
I guess this just goes to show I'm in over my head with this. I was using the above code to find birthdays comming up in the next 30days, but now i need to show dates of events in the future. so like if i wanted to see upcomming appointments with in the next 30 days it would show that.

Thank you everyone for your help, I think I still have a lot to learn so that I can help you help me, right now I just don't know what I'm doing.

Thanks,
gordy
Jan 29 '07 #7
Thank you to everyone who has been tring to help me, I've actually figured it out. just had to change Now() to Date() and changed *365.25 to /365.25 and that fixed it. heres the finle code for anyone who may want to use it down the road.

Expand|Select|Wrap|Line Numbers
  1. ((([DEROS]+((Int((Date()-[DEROS])/365.25)+1)/365.25)) Between Date() And Date()+30)) 
Jan 29 '07 #8
NeoPa
32,556 Expert Mod 16PB
Thanks for posting that Gordy.
It's always good to have a resolution post and I'm pleased you got it sorted out :)
I guess [DEROS] is your table's date field.
Jan 29 '07 #9
Thanks for posting that Gordy.
It's always good to have a resolution post and I'm pleased you got it sorted out :)
I guess [DEROS] is your table's date field.
Yes, sorry about that not telling everyone that.. DEROS is a millitary term. for date of loss. so I can keep track of when my soldiers are getting close to time to leave. thanks for the help!
Jan 29 '07 #10
NeoPa
32,556 Expert Mod 16PB
Not a problem. Glad to help :)
Jan 29 '07 #11

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

Similar topics

14
by: smilemaster | last post by:
I have recently started experiencing form data loss. Here is an example: ====test_form1.php==== <form method="POST" action="test_form2.php"> <input name="textboxvalue" type="text" size="20">...
3
by: Nicola | last post by:
Hi Everyone, I am new to programming and would like to know how to open an access Report from within vb 6. I am trying to write a program to organise cross stitch threads. I have found out how...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
0
by: sid | last post by:
Data loss in Access-97 from VB 6.0 I have encountered Random data loss in our access database. Sometimes the users call in saying that the records entered by them are lost. The users, use our VB...
7
by: Neil Ginsberg | last post by:
I'm having some problems with an Access 2000 MDB file with a SQL Server 7 back end, using ODBC linked tables. I previously wrote about this, but am reposting it with some additional information and...
9
by: Tim | last post by:
Hi, has anyone experienced a spontaneous loss of a subform bookmark (i.e. resetting to the first record), when the computer is idle. I used to have a problem in NT4 when doing a couple of...
6
by: Bob Alston | last post by:
I am looking for Access reporting add-in that would be easy to use by end users. My key focus is on selection criteria. I am very happy with the Access report writer capabilities. As far as...
2
by: amith.srinivas | last post by:
Hi all, From a word macro in VBA, I am trying to create a report in access DB. The report is based on a query with a parameter. I am using Set rpt = Application.CreateReport rpt.RecordSource =...
2
by: chetchet007 | last post by:
I have a stock table with the cost price and the selling price, then i have an invoice that is produced. i need to produce a profit/loss for either daily, weekly or monthly i want to do this by drop...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.