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
 
Ok, I will ask again, can you please create the query I asked above, and post the SQL code here?
Simply create a new query from your table and add the two date fields. That is it.
Then change the query to SQL View, and copy and paste the SQL code here.
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
You will have to forgive me as i am a novice with Access at the moment,

Let me see what i can do with the query
 
Upvote 0
Ok, I will ask again, can you please create the query I asked above, and post the SQL code here?
Simply create a new query from your table and add the two date fields. That is it.
Then change the query to SQL View, and copy and paste the SQL code here.


Is this what your talking about?

SELECT Sheet2.[Open], Sheet2.[Closed]
FROM Sheet2;
 
Upvote 0
Yes, exactly.

So I created the Table, exactly the same way on my side, and created the query.
And here is the SQL Code for the working query:
Code:
SELECT Sheet2.Open, Sheet2.Closed, IIf([Closed]>0,[Closed]-[Open],Date()-[open]) AS Days_Open
FROM Sheet2;

So, if you do go into the query you created for this, change to SQL View, and copy and paste the code above there, does that work when you go to view the results?
 
Upvote 0
You don't need it in your Table. What makes you think you need it there?
All calculations should be done at the Query level, not the Table level.
Just about anything that you use Tables for (i.e. Forms, Reports, Exports) you can also use a Query for.
 
Upvote 0
Hi Joe
The idea behind it being in the table is when a user is looking at one record via the form I have created I would like them to be able to see how many days the record has been open for prior to it being closed

Hope that makes sense and also thanks for all your help so far
 
Upvote 0
Base the Form on the Query, not the Table, and the calculated field will be there.
 
Upvote 0
Create your query to show all the fields in your data, as well as any calculated fields that you want.
Then, go into your Form, click on Properties, and change Record Source property from the Table to the Query you just created.
It will then show you all the fields in your query that are Available, and you can add the Calculated fields to the Form.
 
Upvote 0

Forum statistics

Threads
1,223,956
Messages
6,175,611
Members
452,660
Latest member
Zatman

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