DateDiff Issue.. Any Thoughts

Feb 27, 2007

I am trying to calculate the number of weekdays between two dates in an access query.

I'm using Expr 1: DateDiff("w", #4/01/2006#, #02/26/2007#)

When I use this expression with "d" instead of "w" I get 331 days, but when I use "w" I get 47 days. I know this can't be right.... Is there something I'm missing here?

I looked up on msdn and "w" is for weekday. Is there something that I need to do to be more specific?

Any help is appreciated.


Thanks

View Replies


ADVERTISEMENT

Some Thoughts

Jun 23, 2005

Hi All,

I am currently using some of the code from ghudson's browsing2.mdb for importing XLS files into a database that I making. After pressing the import button which triggers the importing of the file it imports the contents of the XLS into a table called import and into another table at the same time. Both the import table and the other table have the same structure. For the sake of argument lets call the other table "table B".

I want to know of a way of how during the import of the XLS it can flag with a message box to say that that the information already exists in table B, and exit out of it. I was thinking this would be done in VBA. I have written some part of it (very basic) and would appreciate someone's opinion if I am on the right track. It basically searches if the same data lies in the 2 tables and pops up a message box. I would welcome any other solutions, but I would prefer it to be VBA.

----Start of Code---------------------------------------------
Dim strCompare1, strCompare2, strAppend1 As String

strCompare1 = "Select table B.field A from table B where (select import.field A from import);"

strCompare1 = "select import.field A from import where (select table B.field A from table B);"

CurrentDb.Execute strCompare1
CurrentDb.Execute strCompare2

If strCompare1 <> strCompare2 Then
strAppend1 = "INSERT INTO table B ( field A, field B, field C) SELECT
Import.field A, Import.field B, Import.field C FROM Import;"
CurrentDb.Execute strAppend1
Else
MsgBox "Piece-Marks already exist in the database, so if it is an update
then use the update function"
End If

--------End of Code--------------------------------------------------

Cheers
Greg

View 1 Replies View Related

Thoughts On VB.Net Front End

Nov 21, 2007

I have a wonderful database I designed almost 2 years ago. Other than a few hiccups with corrupted data (http://www.access-programmers.co.uk/forums/showthread.php?t=135483), my employer is 100% satisfied with it.

I’m graduating this winter with an AS in computer programming and I would like to update the database to a VB/ADO .NET (VS 2003) front end before I leave. Being a VB developer, I have had my fair share of “quick fixes” when I could not work out a solution with VBA. VBA is the evil twin of VB lol.

Other than PHP w/ MySQL I have never used two separate entities for data management. It’s always been strictly MS Access as the database and front end.

So my question is what major differences should I expect that I took for granted with MS Access’s built in functionality? Such as subforms with master/child properties, navigation, printing reports etc. Will I have to write code for every little detail that MS Access handled for me?

What are your thoughts on using VB.NET as a front end? Did the pros out weigh any cons from your experience with this setup? Any thoughts on using Crystal Reports?

View 3 Replies View Related

Help With Thoughts/idea's On Doing This

Oct 14, 2004

Looking for some advise and help. I think an array will be recommended and if so, please help with code on how to do this.

I am trying to track prescription (Rx) dates (RxOutDate) going out to medical professionals on a particular order. There can be mulitple Rx going out so there will be multiple dates of when those Rx went out. What I would like to do is have the earlies date posted. ie one Rx went out on 10/13/04 and another goes out on 10/14/04. I would like for the 10/13/04 date to show. I'm using a continuous form to display all Rx's per order, on frmRx. I'm trying to display the date out on the form containing the order (frmOrder).

Any thoughts would be greatly appreciated. If an array is suggested. Please help with code on how to it. I've never written one so I would definitely be in the dark.

Thanks ahead of time,
Shane

View 1 Replies View Related

My Questionaire Table Design-normalization! Your Thoughts Please?

Jun 16, 2006

Im planning a db client's dinner questionaire that will comprise of client's favorites (meals, games, transportation). Each client is allowed to bring a guest. So the client's will also be filling out "the same set" of questionaire for his/her guest.

Meaning, a user will need to fill out the same form twice, one for himself and one for his guest.

Now, my question is, should i have two tables. Client's questionaire table and Guest questionaire tables with foreign key in the guest's table showing who's guest the question belongs to?

Or should i have one table for everyone (since they are the same set of questions). Having one table seem like a wise idea since it's the same set of questions (don't want to have 2 duplicate tables with only one field different). Now, if i go with one table. How do i go about handling this? So that client's and guest's info are linked. and i can run a query to tell who's guest it is? I have never tried thsi before. Care to share your thoughts?

View 3 Replies View Related

Storing Multiple Ranges Per Record...thoughts?

Jun 21, 2007

Hi, I'm very new to this so your patience and help is requested.

I need to store multiple ranges per record in my relational db, i.e.

A: 3500-4800, 5230 (spot) , 6400-7900

Etc, I need the data to be searchable with minimal fuss and coding.

Any help would be very very welcome.

Cheers

View 5 Replies View Related

Weird Table "corruption" Occurring. Thoughts?

Mar 10, 2008

I put a split database (created in 2000 format using Access 2003 SP2) on the network three weeks ago. Three times the entries in two of the columns have been changed for every record, essentially making the data useless. I have not been able to narrow it down to a specific event that is causing it in order to program around it. Any thoughts would be greatly appreciated. Here are the details:

The table involved is called tblTitleLog. It contains 13 columns, the first of which is an autonumbered ID field. Column 7 is called CompletedCSA. Column 9 is called CompletedDate. The data in those cells could be different, from record to record, or could be the same as several records on either side of it. The data in those two cells can be updated either of two ways:


On a per-record basis using a form that contains controls tied directly to the cells for a given record, or
On a form that incorporates a multiselect listbox and an Update button. This form is specifically designed to allow batch updating of those two columns.


On three separate occasions, the data in those two cells suddenly changed for all 6940+ records. For example:

This:
CompletedCSA CompletedDate
Timmy 2/2/2008
Bobby 2/5/2008
Joey 2/10/2008

Would suddenly change to:
CompletedCSA CompletedDate
Bobby 2/5/2008
Bobby 2/5/2008
Bobby 2/5/2008

No warning messages about multiple people trying to change the same record(s) is displayed. None of the users have been able to spot a trend in something they were doing when it occurred. The code for the Update button on the batch update form only changes the records with the ID of the SelectedItems.

This is the code from the Update click event on the BatchUpdate form:

For Each i In Me.listboxTitles.ItemsSelected
strWhere = strWhere & Me.listboxTitles.ItemData(i) & ", "
Next

If Len(strWhere) > 0 Then
strWhere = "WHERE ID IN (" & Left$(strWhere, Len(strWhere) - 2) & ")"
End If

strSQL = "UPDATE tblTitleLog " & _
"SET tblTitleLog.CompletedCSA = '" & Me.cboCompletedCSA.Value & "', tblTitleLog.CompletedDate = '" & Me.txtCompletedDate.Value & "' " & strWhere

CurrentDb.Execute strSQL, dbFailOnError

The controls on this form are all unbound.

Duplicating the same actions the users reported just before it happened didn't seem to make a difference. So far, I haven't been able to duplicate the conditions. Management is not happy and I'm frustrated. Any thoughts or suggestions on how to prevent this from happening again?

Thanks,

DiverGuy

View 10 Replies View Related

DateDiff

Jun 16, 2006

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.

Thanks

View 4 Replies View Related

How Do You Use Datediff?

Jan 2, 2008

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

View 5 Replies View Related

Need Help With Datediff

May 14, 2007

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?

Thanks
Raj

View 5 Replies View Related

DateDiff Help

Dec 2, 2005

I need to caculate the difference in days between to dates. I would like to include only Business days but would settle for any help at this point

Thanks in advance
-WM

View 5 Replies View Related

DateDiff

Jul 16, 2007

Hi there.

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.

View 4 Replies View Related

Datediff???

Oct 3, 2007

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

View 1 Replies View Related

Datediff() Help

Apr 9, 2008

I have a call tracker database.

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.

I would need the query to look like this...

Total Calls | Avg Call Time
100 | 5.33 (min.sec)


Thank you

Lucas

View 11 Replies View Related

Datediff HELP!!!

Sep 20, 2004

I have a form that has a start time end time and total time. I am using date diff to calculate the total time and it is working fine, but i want the output to be placed into Total time field of a table. I am new to access and DB in general. Any help would be appriciated.

Greg

View 6 Replies View Related

What Am I Doing Wrong??-Datediff

Aug 30, 2005

I am trying to calculate the total number of days between a date (i.e, csdate) and todays date in a Query for a Report.
I have tried the DateDiff command in the query line and in an unbound box on the report but it is not returning the right values.
Can Someone tell me what I have done wrong. I have checked that the date is in long format and tried it in short format as well with the same results. Below is what I have tried.
csdays:=DateDiff("d", [csdate], Date()) I have tried the Now() command as well, but it is not right either.
Please help!

View 6 Replies View Related

DateDiff Error

Mar 21, 2006

My company recently switch us from Access 2000 to Access 2003. A query that previously worked, no longer works. I've searched the previous posts and Access help and updated the query based on the search results, but still receive the error message. "Undefined function 'Date' in expression."

Here's the query calculation:

AppOut: DateDiff("d",[AppMailed],Date())

Would someone please let me know where I am going wrong?

I've gotten it to work with this calcualtion, but the user has to manually enter today's date each time. But I know there has got to be an easier route.
AppOut: DateDiff("d",[AppMailed],[date])



Thanks =)

View 3 Replies View Related

DateDiff Problem

May 12, 2006

I am using Expr1: DateDiff("d";Date();[Expiry Date])

I am having a problem , the date diff uses the date in this format " mm,dd,yyyy"

but in my program I enter the date dd,mm,yyyy, is there is way to change it, I know that in sql you can do it, ms access is abit different, any solutions to that.

View 6 Replies View Related

DateDiff In A Query

Jul 26, 2006

Have a table which has 4 fields PatientID FirstName,LastName,BalanceDue,Due Date
Trying to create a query that will show all fields of the accounts that have due dates that are under 30 days. I tried this Under30: DateDiff("d",[DueDate].Now())criteria >0 And <30. But can't put anything in the parameter dialog box which after clicking ok shows any data. If I can get this to work my hope is to have 3 more catagories. over 30 days, over 60 days and over 90 days. I'm new at access and could really use some help.

View 3 Replies View Related

Problem With DateDiff

Mar 28, 2007

Morning

Pretty new to all this, so forgive my ignorance but i'm having problems with DateDiff. I have a table with 2 dates in it, and I want to work out how many working days (or working hours if possible) are between the 2 dates


SELECT DateDiff("d",[Date Opened]+[Date Closed])
FROM Dashboard;

I want it to print it the number of working days/ hours in a new column in the Dashboard table if possible.

Any ideas?

Thanks

View 4 Replies View Related

DateDiff Function

Jan 18, 2008

Hello,
I am trying to create a query that subtracts "TimeOUT" from "TimeIN" fields to calculate the total time worked.

The "TotalTime" is a new field that is not in the table, only in the query.

I am attempting to use the DateDiff function to calculate this, but I need to return both hours and minutes.

Currently, it looks like this:
Total Time: DateDiff("h",[Time IN],[Time OUT])

It works this way to return the total time in hours only.

The DateDiff function works to return either hours (h) or minutes (n) but I cannot figure out how to get both!

Perhaps someone has an answer or possibly a better way to get the results in hour:minute format for me??!!

View 6 Replies View Related

DateDiff Formula

Jan 24, 2008

Hello,
I create query that subtract “schedule date” (mm/dd/yyyy) and “deliver date” (mm/dd/yyyy) to calculate difference deliveries days. I used function DateDiff different ways but query doesn’t work.

Expr1: DateDiff("mm/dd/yyyy","SCHEDULE DATE","DELIVERY DATE »")
And I have error: “data type mismatch in criteria expression” or doesn't work.

Thanks for helping.

View 5 Replies View Related

DateDiff Question

Mar 11, 2008

hey guys i have a query where i want to return all values with a difference greater than a value entered in the user.

Now DateDiff is working fine for this but the only problem i am having is if i set it to > FormTextBox nothing is being selected but if i actually put in a number e.g > 10 in the where clause it works fine. Any ideas?

View 3 Replies View Related

Datediff Problem

Jul 31, 2005

:) I'm having problems with a simple piece of code using datadiff. all i want is to know how days from today is 3/10/2006, which obivously will countdown as everyday gets closer.

joe

View 6 Replies View Related

DateDiff Function?

Sep 16, 2005

I'm trying to add a txtfield that the control source is 65 years prior the current date.

So the control source should come up with "1940". I've tried the datediff function, but not having any luck...any suggestions?

Thanks.

View 2 Replies View Related

DateDiff Rounding Down

Feb 28, 2008

Does anyone know if it is possible to round down a datediff functions calculation?

Thanks.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved