I have a table with a date/time field named “teLezenOp”
and I use the following line in VBA:
SELECT * FROM tblBericht WHERE (teLezenOp<=#" & MediumDate(Now, Now) & "# or teLezenOp is Null ) ORDER BY datum
(I use the european notation dd-mm-yyyy)
Here is what goes wrong: yesterday 28-2-2006 there was no problem
But today 1-3-2006 I get an error:
Syntax error in querry-expression: telezenOp<=#1-mrt-2006# or telezenOp is Null
If I look in my acces DB telezenOp = 20-2-2006 so there is a difference in notation? 20-2-2006<= 1-mrt-2006 I don't think this is the problem because yesterday it worked with the same code.
now I've just read the following in one of the threads on the forum:
"In VBA code and query SQL statements, the date between the # signs must be put in US format. So #4/1/2005# means April 1, 2005."
I guess this is the reason of my problem:
I compare a EU notation with a #EU#(so that is incorrectly read as a US notation)
is there an easy way to switch between EU and US notations in VBA/sql statements?
I guess there is but I can't find it...
tnx for any (hopfully rediculously simple) tips/tricks/sollutions
Hello buddies :D, do you have any idea how to make this work?
To select data that falls within this criteria of date range between cboDate and cboDate2 (fields on my form). The date in [tblJobDetails]![timeIn] come in this format "08/17/06 10:24 AM", but the cboDate/cboDate2 (takes in date only e.g 08/17/06) what i am after is to evaluate specific hard coded time in addition to the date entered, i.e. even tho, i haven't entered time on the cboDate/cboDate2, I want specific time hard coded where e.g If i select a date range of 08/17/06 and 08/18/06 on my cboDate and cboDate2 it should really be evaluating: 08/17/06 8:00 AM to 08/18/06 8:00 AM.
This is the criteria i curentlly have on my query in design view tha works perfect in selecting date only. ([tblJobDetails]![timeIn]>=[Forms]![frmPendingJobs]![cboDate] Or [tblJobDetails]![timeIn]>=[Forms]![frmPendingJobs]![cboDate] Is Null) And ([tblJobDetails]![timeIn]<=[Forms]![frmPendingJobs]![cboDate2] Or [tblJobDetails]![timeIn]<=[Forms]![frmPendingJobs]![cboDate2] Is Null) How can I incorporate 8:00am to 8:00am into my cboDate and cboDate2. What can i do to make this happen? Your kindness will be greatly appreciated http://www.naijaryders.com/forums/images/smilies/thankyou.gif
I have a database with date and time each stored in a separate field. Now I want to query the database based on a start date/time and an end date/time. I started with the code below but it only returns events within the same time range on each day when what I really need is every event from a specified date and time through a specified date and time.
SELECT myTable.ID AS myTable_ID, myDate, myTime, FirstName, LastName FROM Staff INNER JOIN myTable ON Staff.ID = myTable.StaffID WHERE myTable.myDate >= #3/2/2014# AND myTable.myDate <= #3/3/2014# AND myTable.myTime >= #8:00PM# AND myTable.myTime <= #11:00PM# ORDER BY myDate desc
In the above example what I want is every event from 3/2/2014 8:00PM until 3/3/2014 11:00PM. But what I get instead is every event between 8:00PM and 11:00PM on 3/2/2014 and every event between 8:00PM and 11:00PM on 3/3/2014.
I have a table that has entries recorded with date and time in one field, and I want to have a query that returns all records of a specified date or date range, regardless of the time in the field.
I have tried
Code: Between [StartDate:] And [EndDate:]
And
Code: Between [StartDate:] & "00:00" And [EndDate:] & "23:59"
I have a database that stores information for lab testing. Each time a tech does a "step" in the test process he logs it in the table, using an input form. There are different categories, for example preparation, testing, analysis, etc, and each of those steps take time. I have the form autopopulate the date and time with NOW() evertime the form is updated. What i want to do is calculate the time it takes to do each in days. I can easily get how many days it was from now since they logged the test, =NOW()-TestDateTime. What I want to do is get the number of days it took to do each step, ie the number of days between each event. Is there a way to do this?
I have an attendance database and I connect the time attendance machine db to my access db, what i am trying to do is to generate a report that shows the time in and time out for specific date. the type of attendance db is date/time.
Please see the attached screenshot db from attendance machine.
an also some time there is duplicate entry, I need to get the first and the last entry only for specific date.
I have a date/time text field on a form with the General Date format and a combo box next to it that has sequencial times as the row source (IE. 12:45 AM, 1:00 AM, 1:15 AM, 1:30 AM, ETC.) When the user chooses a time in the combo box, I want the time portion of the text box to be updated with the chosen time in the combo. I have tried a few things but cant seem to get it right.
so i created a system to have events booked, and i am trying to check time availability of the event room available, but i dont know what wrong. it either my query or vba code. i have attached the attachment,
Wonder if someone can help please. I'm quite new to Access so please bear with me.
I have a data field in my database consisting of both a date and time.
I then have a form containing two fields where the user can type a 'To' and 'From' date to extract the records that they are interested in. The query behind this uses the 'Between[Enter The Date] And [Enter The Date]' coding.
The problem is that because the field contains a time it doesn't return any records when I run the query.
Can anyone offer a bit of guidance on how I could ignore the time part of the field perhaps by adapting the above.
I have a column/field named [DateTaken] which contains test dates and times in the same cell. I am needing to find those with a test time less than 2:30 pm or <14:30pm.
I have a form with Date of Death (DOD) field. I would like update DOD from a table dbo_patient into Z_Patients table.
I have set the datatype as Date/Time in the form for Date of Death.
Code: Private Sub Update_DOD() Dim rcMain As New ADODB.Recordset, rcLocalDOD As New ADODB.Recordset Dim DOD As String rcMain.Open "select distinct PatientKey from Z_Patients", CurrentProject.Connection
[Code] ....
However I am getting some error Run-time error '-2147217913 Date type mismatch in criteria expression in section below.
Code: CurrentProject.Connection.Execute "update Z_MAIN_Processed_Patients set DateOfDeath = '" & rcLocalDOD!date_of_death & "' where PatientKey = " & !PatientKey
I have a query based on a table which has a date field. the field both in the table and the query have the time also in the date value so when I try to query on a date I get nothing if I copy the date and time from the field I will get the result for that record if I just use the date I get nothing. I have tried the format which does display just date but if you click on the field the time is also there You must be able to query for a date only and get all the records.
In VBA, how to compare date variable with date/time field from table, as when defined the data type in table, date/time option is the only choice for date data type even though I don't want the time portion.
I am trying to compare a value in my databse produced by the date() function, short date format, to one that is exactly 24 hours after the value recorded by the date() function. If the value in the database is 24 hours prior to the current date(), I need to flag a text box a diffrent color to alert the user. I am unsure on the If statement that I will need to produce this result.
Any help would be greatly appreciated!!!! Thanks Mikeco555
I have a report that have a datebox(Short date) and a timebox(Short time) and also a box that contains numbers like 36:59 and so on. That number is hours and minutes, I would like to take the date, time and add my 36:59 and get a new date from that and put that in another box. The date and time is used as planned date and planned time for some work to happen. 36:59+planned time+planned date=should be planned finishing date and time. Does anyone know what I have to do, to make this happen ???
How can I create a field in a query, extracting the date portion of a date/time field? The format is mm/dd/yyyy hh:mm:ss. I need just the mm/dd/yyyy so I can prompt the user for a date range, without them having to key in the date mm/dd/yyyy 00:00:00 to mm/dd/yyyy 23:59:59. Please Help
I have a table called : tblTemp contain the field: EndTime (type: ShortTime)
A combo box: cboTime
How can i assign value for cboTime using the field: EndTime from tblTemp
I tried:
dim db as Database Dim rec as DAO.recordset set db = currentDB() Set rec = db.OpenRecordSet("tblTemp") 'Go to appopriate record cboTime = rec![EndTime]
But i recieved the message: You can't assign a value for this object ...
Okay i know you can make a form post the date and time with the =NOW() command, is there a way to make it so it shows the current date and time? so you can watch the day go by in seconds if i wanted to?
This is very tricky I hope that someone can help please. I have a table that I imported to access, it has four columns, start date start time finish date finish time. I need to generate a report to show items that took more than 30 hrs, ontop of this items that fall within friday have a different senario. Someone gotta help.
I have a field [Date] in one of my tables, and the field is set to Date/Time datatype....format is "mm/dd/yyyy"......but when I type in "03/29/2005", I get an error saying that "the value you entered is not valid for the field".....
I have a field in a table set to Date/Time. Is it possible to set the properties so that it always defaults to "PM"? In other words, if I enter "5:30" and then TAB, I always want it to be entered as "5:30 PM". Right now it appears to default to "AM". For this particular application, 90% of the entries are made in the PM. Thanks.
I've got a field in a query that is pulling the Date/Time from a table in the db. I've added another field in my query ... Tran_Datetime: Format([dbo_t_PMCS_History]![Tran_Datetime],"mm/dd/yyyy") to format the Date/Time into text so I can use the Date()-1 command.
Problem is ... the Date/time in the database is like 1/1/2006. There is no leading 0 on the month or day. Now when I use the format function with "mm/dd/yyyy" the date() command will only work when the Date/Time is has two digits in the mm/dd fields. Hope this makes sense :confused: