Number of days issue

posfog

Board Regular
Joined
Jun 2, 2009
Messages
171
Hi there
I wondered if some could help me as new to access and having the following issue

I have a database where there are two dates that need to bee filled in

1 is called open for when a issue is reported and the 2nd on is called closed for when the issue has been resloved.

Now i also have a field called days open where i want to beable to show the number of days a issue was open for ( number of days between open and closed) or if the issue is still open for it to work out the number of days from it being open and the current date.

Is this possible at all?

Regards
P
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
"Days Open" should not be a stored field in your database. The rule of thumb with databases is that anything that can be calculated should not be stored, as that undermines the data integrity and dynamic ability of a relational database. You would just perform that simple calculation in a query using a calculated field that looks something like this:
Code:
Days_Open: IIf([Closed]>0,[Closed]-[Open],Date()-[Open])
 
Upvote 0
Hi Joe,
I am getting the following error?
The expression you entered had invalid . (dot) or ! operator or invalid parentheses.

Any idea??
 
Upvote 0
You are entering this in a calculated field in a query, right?
Please post the exact formula that you entered here (including all your modifications).

Also, create a new query from the table that contains these fields, add the two dates to the query, change the query to SQL View and copy and paste the SQL code here.
 
Upvote 0
Did a new calculated field and entered
Days_Open: IIf([Closed]>0,[Closed]-[Open],Date()-[Open])

into the expression builder then got that error message
 
Upvote 0
Is the correct table added to the field?
Are "Open" and "Closed" the EXACT names of your fields (if not, you will need to change to suit)?
You don't have a field already named "Days_Open", do you?
 
Upvote 0
Data stored in Sheet2
One Field called Open
One Field called Closed

No fields called Days_Open

Clicking on More Fields and selecting Calculated field and tried using both Date option and Number and keep getting same issue?
 
Upvote 0
Should have probably asked first, but can you confirm that the two date fields actually use the Date/Time data type in your Table (and are not, in fact, Text)?

Can you do the last step I asked in post 4 and post the code here?
create a new query from the table that contains these fields, add the two dates to the query, change the query to SQL View and copy and paste the SQL code here.
 
Upvote 0
The fields are extactly the same and i have no field called Days_open

I click on More fields and chose Calculated field and then entered your formula into the expression builder then got that error message?
 
Upvote 0

Forum statistics

Threads
1,223,954
Messages
6,175,601
Members
452,658
Latest member
GStorm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top