Basically my database is for a library based on borrowing/returning books ect
Everything works except this one thing, in one of my forms I can ask the user to input a book number of the book they want to check if it has been returned or not, if it hasnt been returned within 30 days then it will come up with overdue.
The statement im trying to use i cant get it to work.
=IIf([DateDiff("d",[Borrow Date],Now()>30)
I want it to display overdue if the book isn't returned in 30 days of the borrow date.
I have a specific question on the datediff function.
My example is =DateDiff("d",[Policy Issue Date],Date()) where [Policy Issue Date] is the inception date of an Insurance Policy.
I need to determine how many days the policy has been inforce. The formula works great in a query and I can see the number of days in that field when the query is run.
However, my dilemma is I want the same function to run off of a text box using its control source property and have the number of days calculate and be visible for each record on the form. This part is not working and the field is returning the #Error? message.
I am struggling with the DateDiff fuction in a calculated field. After some study, I have used several variations of:
=(DateDiff("d",[DUED],Date())/7)
to calculate the time (in weeks) until a due date starting from today's date.
It continually turns up a specific date in the late 18 and early 1900's. It does not give me the number in weeks which was what I was hoping for.
Earlier I used a very simple: =DateDiff("m",[Birthdate],Date()) to calculate the age from a date of birth perfectly with no problems.
I do not understand why the formula is not working. Does it have to do with format or the fact that I am working with a future date and how can I rectify this problem?
I would like to ask if I would like to count the number of days between two date, but EXCLUDE Fridays, Saturdays, Sundays since the workers ONLY work Monday thru Thursday. I am using the function DateDiff as follow:
DateDiff("d",[Date1],[Date2]) with Date 2 is later than Date 1.
However, the results count calendar days. HOW do I exclude Fridays thru Sundays fall within Date 1 AND Date 2?
I've created a database where a query who'se result is loaded on a form uses following function --
DateDiff('d',Date(),[Target Date])-(DateDiff('ww',Date(),[Target Date])*2)-(Select Count(*) from [tblHolidays] where [HolidayDate] between Date() and [Target Date])
I've notice that 2 ppl get an error message when they try to open database, with thatt function coming on an error message Does this mean they have older access version ? How can I tell ? Any advise on what to do ?
I am finishing up a database that logs basic activities/tasks for my coworkers. As they go in to the database and log an activity in it stays open until they end their day or they start a new task. All this works fine, but the problem comes when I try to determine the total time spent (in hours) on each activity/task. I have written similar queries before and they worked just fine, but for some reason I am having trouble getting this one to work. Here is the expression I'm using...
Time Diff (in hrs): DateDiff("h",[Sample_TM_Table_1]![Time_In],[Sample_TM_Table_1]![Time_Out])
Unfortunately, say Time_In = 8:32:38 am and Time_Out = 8:33:03 am The expression says that is equal to 946632.
For another Time_In = 8:33:00 am and Time_Out = 3:18:19 PM. The expression says this equals 946639.
I have tried changing the format of the date/time in both Time_In and Time_Out fields to ensure they were the same and cross checked the expression but still get the same answers each time. Even when I try to use "n" for the interval or "s" it is still highly incorrect. The only thing that makes me think I still have a formatting issue is that the Time_In shows a long date on the results table while Time_Out shows it in a general date format. However, when I go into both the table and the queries to check the formatting they both show general date. Any ideas? I'm all out! Thanks in advance.
I am trying to calculate the difference in dates between two fields. How do I find the difference in days between field one which contains the date 04/12/2011 and field two which contains the date 04/12/2013? I have tried to use the datediff function, but it keeps telling me it doesn't recognize the field name, even though the spellings correct.
I'm trying to create my own database dealing with hiring bikes on a daily basis.
I have created a form for the basic input, including StartDate, StartTime, EndDate and EndTime, followed by TotalDays. I added the time field so that if a client brings a bike back an hour or two after the pickup time on a later date (sounds complicated - e.g he takes it on Monday at 12pm until Thursday 14pm) then he would be charged for an extra day. It is similar to the car rental system used worldwide.
The TotalDays is currently using a simple expression =EndDate-StartDate.
Is there any way to make the form incorporate the time difference so that if EndTime-StartTime>1 then it would add an extra day to the "=EndDate-StartDate" calculation.
I have created a countdown counter on a form using different Datediff's so to split the renaining time into days, hours, minutes and seconds.
The Datediff compares Now() to a text box called txt.Leaving which has a date/time unputted via a table (Format: General Date)
However the seconds and minutes work ok but the hours and days dont count down inline with the minutes and seconds reducing. The hours do alter when the minutes are 13 mins into the new hour. This would seem to point possibly to rounding off but I would expect that further into the hour.
Below is the Datediff that is set as the control source in a text box and the form it sits on has its timer set to 1000 and the event requeries the text box.
=DateDiff("d",Now(),[txt.Leaving]) & "d, " & DateDiff("h",Now(),[txt.Leaving]) Mod 24 & "h, " & DateDiff("n",Now(),[txt.Leaving]) Mod 60 & "m, " & DateDiff("s",Now(),[txt.Leaving]) Mod 60 & "s"
How is the collection of a sum of money to a particular substance.There is, for example, in the table named baby milk product.How can I collect the amounts of such material only.I used a DSum
I want to be able to use the Count function that will reside in the header of the main navigation form that will count the records in each navigation sub form (of which there are 6 sub forms)
Each sub form has the same primary key which is what I am doing the count on.
I have done this on another form with no subforms by creating a Textbox with this code: =Count([PCNumber])
I have tried to put this in the header of the main navigation form with various itterations, the last being: =Count([Form]![NavigationSubform].[PCNumber])
But what ever I do seems to come up with "Error" in the textbox.
For info, the form names are:
Main form :StockViewsForm Subform:NavigationSubform
PCNumber being the PK I want to count.
Is this possible of do I need to specify the names of the actual forms that reside in the Navigation Sub Form ??
I recently created a database to be used to store incoming invoices. We have 4 suppliers which supply the same material and wanted each supplier to have its own database.
I began by making a database which included all the key tables, forms, queries and functions I would need to then save 4 copies, one for each supplier. This just meant I would not have to repeat the process for each individual supplier.
The problem is all my data is external and upon importing it into the database it has made the search function (combo box) not return results.
I believe this is because: 1) The form was created before the records existed 2) The records were imported from an external source and not created using the form.
However, the way I have designed the form is so I can see all relevant information linked with a specific invoice. This aids in gathering information quickly about an invoice but also so I can input credit note and invoice query information linked to a specific invoice on the same page.
Is there anyway to remedy this?
Or use a similar search function that returns records in my form "Main View"
The last thing I want to do is have to create the form again, although I don't think this will work either as reason 2) states.
I am having some minor issues with my current database. The way it works currently is having a MainMenu where you can either go to customers/ ProductList/ Product OR ProductList straight away. I have a CustomerT and a ProductT. I have made a Query where I link the two tabels to have the feature showing the customer to the specific product with the criteria: "Kunde: [CustomerName] & " " & [Subsidiary]" on the form I have a txtsearch (Textbox) connected to a button with this coding:
Private Sub Kommandoknap49_Click() Dim strsearch As String Dim strText As String If (Len(txtsearch.Value) > 0) Then strText = Me.txtsearch.Value
[code]....
This allows me to search for text in each of the boxes with information on the single product(s) for example searching for Kunde (Customer in Danish) or ProduktNavn (Name of product) HOWEVER when I do this the "Kunde" turns into "#Navn?" c..If i reopen the Form it will show with the right information. I also tried to code the "Byactivation" to
I have a project at hand and it's been a predecessor of mine and client has asked me to do some work on it and extend functionality - but I have not really delved into Access before and I have had to worked my way through to this final snag :/
The Main Form has one sub form. This sub form allows the user to add multiple order items i.e. qty, stock, description from records within the system - fairly straight forward.At the last column of each row is the sub total of those particular items i.e.
Qty Unit | Item ID | Total ----------------------- 2 | 1234 | 80.00 ------------------------ 1 | 43526 | 20.00 ------------------------ > | |
So the total is a function of =[Qty Unit] * [Unit Price].Then in the Footer of this SubForm is the Sub Total
=SUM([Qty Unit] * [Unit Price])
All fine and well..... However, the additional functionality kicks in.
Lets add the additional customer_id from the Main Form. Each Item bought is dependent on the customer_id i.e. they get special prices depending on who they are.So a New table is made which has the Item ID and SpecialPriceID (of a table to define as a specialPrice) and the Price linked to this Item and Special Price category. So say that there are two groups of users "wholesale" and "nonwholesale" these would be SP_1 and SP_2 and each client is defined either one of these, and each stock item has a Price for each SP_1 and SP_2. Hopefully I've explained myself there.
Back to the SubForm. So now the Total needs to calculated differently with needed the external customer_id from the Main Form.
Code:
Function CalculateSpecialPrice(ItemID As String, CustomerID As String, Unit As Integer) Dim SPSelect As String SPSelect = "SELECT Price FROM [Items_SpecialPrices] WHERE" SPSelect = SPSelect & " ItemID = '" & ItemID SPSelect = SPSelect & "' AND SpecialPriceID = (SELECT SpecialPriceID FROM Customers WHERE customer_id = " & CustomerID & ") "
[code]....
its the sub total I just keep on getting #Error on. I have even watched (using alerts) that the correct return variable is the same as the individual rows. This is the equation I used for the SubTotal within the footer.
Is there a way in a query to write a datediff that looks at all the possibilities month, day, year? I have 10 different fields that I need to do a date diff on. I would like to have the fields checked in one place rather than 10 day checks then 10 month checks and 10 year checks. I don't need to use the data any where but I need it to let me know if there is a difference between a calculated date and a date that was input by a user. If there is then I know the user input the wrong date, and it shows as an error.
I have heard of this datediff thing on access. How do you make it work? I also want to do a calculate between the date of birth and date of death? Bearing in mind they are all different. I am wanting if possible to list the age at death either as for example 70years and 85 days or 70.233 years
Hi, I am trying to calculate the number of days between 'today' and a 'date of birth' field. In the field properties Default Value I am using =(DateDiff('y',Date(),[dob]) where Date() gives today's date and [dob] is my 'date of birth' field. However, this is not working. I get an error "(The database engine does not recognize either the field 'dob' in a validation expression, or the default value in the table 'Table1')"
I have set the data type for both fields to 'Date/Time'. What am I doing wrong? Is there any alternate method?
Also, how can I calculate height in feet & inches (5'6" or 5.6 or 5-6) from a given height in meters?
I'm using the following code in my Access aplication: DateDiff("h", IncStart, txtrts)
My problem is i need the exactly time difference and if the difference is 2hours and 15 mins it will display only 2 hours. Is there any way to do that? I've tryed in min but it display 135 mins.
hello all, would really appreciate some extra help with this, many thanks,, the story is as follows,,,,,,,
hello all, i have a very simple databse with two table in it,, both table share a lot of common information, including a primary key called jobcard number,, i want to know if there is a simple query i can run that will find any differences in the start date fields that are found in both tables any help would be much appreciated cheers wardy --------------------------------------------------------------------- Look at DateDiff function in the help for the time differences.
Thus for example in a new column in your query you can type: DifferenceInDays: DateDiff("d",[Table 1 Name].[DateField Name], [Table 2 Name].[DateField Name]) -------------------------------------------------------------------- thank you DrSnuggles, could you explain in idiot proof instructions? do i enter the diffdate code in the criteria row of the select query? also, what do i need in the field and table rows? is it the table and filed i'm comparing the data against? once again many thanks
What I'm trying to create a query to view all my calls' time average (opened date and resolved date). Basically, how long it took to fix a call or problem... whatever...
I tried with datediff(), but had problems getting the Total Avg.