Access2000 Nested IIf() Functions In Date/time Format

Aug 8, 2005

I am working on a report in Access2000 which is getting information from several tables via a number of queries.
I am using nested IIf() functions to combine text formatted data in a calculated query field before using it in a report.

One such IIf() function is

Desc_col: IIf([HOVR - UDP].[SERVICE] Is Not Null,[DA] & " " & [SEQ] & " " & [TYPE] & [MO] & " " & [SUB] & " - " & [HOVR - UDP].[SERVICE],
IIf([MinOfCCT] Is Not Null,"I/O DIST CAB " & [UDP - JC CIRCUITS-05-F].[PWR] & " - CCTS " & [MinOfCCT] & " thru " & [MaxOfCCT],IIf([DESCRIPTIO] Is Not Null,[DESCRIPTIO],"Spare")))

When I have tried to do the same thing with date fields it does not work. The function is fine as long as it is not nested.

That is

Rev_col: IIf([Rev_HOVR] Is Not Null,[Rev_HOVR],"")

and

Rev_col: IIf([Rev_Elec_equip] Is Not Null,[Rev_Elec_equip],"")

both work.

But when I combine them into a nested function

Rev_col: IIf([Rev_HOVR] Is Not Null,[Rev_HOVR],IIf([Rev_Elec_equip] Is Not Null,[Rev_Elec_equip],""))

I get an error message "! Data type mismatch in criterial expression"

There is no data mismatch in the original tables from which the information was extracted. The dates are all in DATE/TIME and set to "General"format in the tables.

I am wondering if I will have to use Visual Basic function to combine these fields. However that poses a problem. When I've looked at this I find that runtime VB is no longer available in Access and I do not want to go out and buy it on the offchance that it will work.

Can anyone tell me if there is another solution to my problem?

View Replies


ADVERTISEMENT

Modules & VBA :: Date And Time Functions Not Using Current Info

Jun 30, 2014

Encountered a situation where the Date and Time functions in VBA are not using current data? I have VBA code that uses Time to determine certain actions. A new associate took a copy of that code and started tinkering with it to complete a project I assigned. Now, his copy of the code returns old data for the Date and Time functions. It returns 5/27/2014 for Date and 7:15:42 AM for Time. The Now function works properly.

Additionally, running the Date and Time functions in queries works fine. I've compacted and repaired the Access database, I've checked the references, and I've checked to see if he assigned values to variables named Date or Time, but I don't see anything wrong. What am I missing?

View 14 Replies View Related

Forms :: Assign Field With Special Format Based On Date / Time Format

Feb 17, 2014

I wanted to assign the field "Number of magazine" with special format based on date/time format but showing only year and month in the format: "yyyy-mm".

So in property of this field in format I put yyyy-mm and in input mask I type 0000-00;;-

I also created the form based on the table containing above field and I defined format and input mask for corresponding formant in the same way like at the table.

But if I try to type date for example 2014-01 in text box of the form it comes up with the full date 2014-01-01. Why does it do like this? What do I do incorrectly?

View 2 Replies View Related

Forms :: Syntax For Nested Aggregate Functions?

Feb 4, 2014

I have a problem with a nested arrangement of Right, DLookup and DMax functions.

The function is for a default value in a text control

=Right(DLookUp("[SampleNumber]","tbldat14A_MasterSampleList","[SampleID]=" & DMax("[SampleID]","tbldat14A_MasterSampleList"))+1000001,6)

I am trying to retrieve the last record from a field SampleNumber which is alphanumeric (e.g. "AK005434") and then add a 1 to it as the next SampleNumber. I had previously used a default value in the txtSampleNumber control as

="AK" & Right(1000000+DMax("[Clip]","[tbldat14A_MasterSampleList]")+1,6)

where [Clip] was a field I have calculated in the table to chop off the preceding characters. Adding 1,000,000 and taking the 6 right hand values and concatenating with "AK" gave me the answer, though it is a but primitive.

This all worked until the SampleNumber value got out of order and blocks of SampleNumber values came in that were then followed by blocks of numbers with lower values (say AK005001-AK005050 followed by AK002001-AK002050).

Now I figure if I just recall the latest entry by DLookup and criteria of DMax on the SampleID (Autonumber Primary key) I could get at the value. I have done this to some success using default values in a series of unbound controls like

=DLookUp("[SampleNumber]","tbldat14A_MasterSampleList","[SampleID]=" & DMax("[SampleID]","tbldat14A_MasterSampleList"))

to get the SampleNumber I require, then a Right function to trim in another unbound box and then use that last unbound box as the default value for the txtSampleNumber control that is the entry for the data table. However, the unbound control box is only valid for the first record and does not update. So, I added a macro that closes the form and reopens it. This all works but is a bit agricultural. I would like to do a single nested function to the default value of the txtSampleNumber control box. Is it possible to nest Right, DLoopkup and DMax into one statement?

View 14 Replies View Related

Access2000 Run Time Error '3326':

Jun 23, 2006

After doing a search, i receive this error(3326) when I insert the found info. J

View 1 Replies View Related

Format Time/date

Jun 15, 2006

Hi all,

i've a field that contains the systemdate n time
i.e
txtDate.value = Now

will give me this 11/30/1899 9:46:00 AM.

How do i get rid of the second hands??

i want 11/30/1899 9:46 AM instead.

Thank you

View 4 Replies View Related

Shorter Date/time Format

Oct 15, 2005

I wish to insert in a table, not the date, but just the month and year (yy/mm or mm/yy), for example 05/10 or 10/05 for October 2005 (the order of yy and mm does not matter). In addition, I need to be able to sort the records chronologically using the same field.
I have tried various solutions with the date/time field or the number field (e.g. using yy.mm where the mm are the decimals). However, it does not seem to work correctly. Any suggestions for how I can do this by configuring the format, inputs mask and validation rule?
Niels

View 6 Replies View Related

Date/Time Format Issue

Dec 20, 2005

Hi

I'm very new to Access, so please be gentle;)

I have imported a appointment database that I need to analyse, however the Date & Time data within the table has been written as;
Date: 20051220 - which I would like to read dd/mm/yyyy (20/12/2005)
Time: 800 - which I would like to read as hh:mm (08:00)

I would like to produce a report of all the queries, i.e. longest appointment, shortest etc... but display them in the correct Date/Time format.

So how should I go about this?
I cannot alter the imported table in anyway.

1. Can I produce a mirror like table of the existing table, that automatically use the correct Date/Time format?
2. Can I alter the values within a query?
3. Can I alter the final output in the Report?

What is the best way to tackle this?

View 6 Replies View Related

Output Format Of Date/time

Sep 3, 2005

Hey guys, been away from Access and SQL for some time. I have a simple 2 column table with one thats set to Date/Time that displays the date only. Unfortunaly, when I run my query, the date comes out 7/9/2005 and I want it to come out as 7/09/2005. I know I am going to have to force it out with a format command, but its been so long that I have no idea how to. Right now my query, in SQL format, looks like this.

SELECT * FROM Table1 ORDER BY Date DESC

I just need the format command to force the date. If anyone can help, thx.

View 1 Replies View Related

Date And Time Format Calculation

Jul 13, 2007

Hi,

I need to calculate the number of days between two days however the format on which i have my date includes the time in the same field -

2007-02-20 07:15:30.474

When I calculate one date minus an other the result is #error
I require the result to be in a count format e.g 2.3 days (like in excel)

Is there anyway to get around this without splitting the date and time?

Please help!:)

View 3 Replies View Related

Dd/mm/yyyy In Date/time Format

Apr 5, 2007

Hi everyone

I have 2 date fields date1 and date2 , and i have date/time data type but what i want to be inputed is in dd/mm/yyyy and not mm/dd/yyyy, what do i need to do in accees both date fields properties to make sure it is in UK date format. thanx

I have played with the format and input mask but i am lost dont know what to do.

Thanx

View 5 Replies View Related

Queries :: Change Format Of Date / Time?

Aug 5, 2013

I am struggling to change the format of 2013-07-29 11:33:03.6160000 to show dd/mm/yyyy

View 4 Replies View Related

Convert Day Of Year Date/time Format To Number

Mar 11, 2008

Hi all,

I have an inherited database with years worth of julian dates stored as numbers (e.g. days 1-366 for a leap year). I also have some fields stored as short dates. I would like to run a series of parameterized queries on this data, some using the short data and some using the "julian dates" that are actually just numbers. I have the user enter the start and end date in short date format and would like that to be converted and held in an unbound field as a number value. So far I can get the date to appear as a "julian date" (e.g. 1/1/08 appears as 1, obviously the underlying data is still 1/1/08) How do I take that 1 and convert it to number value "1"? Thanks in advance.

Cheers,
Peter

View 7 Replies View Related

Forms :: General Date Format - Missing Time

May 3, 2014

I have set a field on my FORM with the General Date format. Every time I use the date picker it inserts the correct date with a time of 00:00? I even changed the format on my table to general date - still no luck.

View 4 Replies View Related

Queries :: Changing Date / Time Format Using Query

Jun 26, 2013

I am having difficulties changing a date/time field like '22/04/2013 09:14' to make it look like '2013-04-22 09:14' using a query.

View 3 Replies View Related

General :: Alter Field Format - Date Time

Feb 2, 2014

I need to alter filed 24-gen-64, in 24/01/64... how to?

View 5 Replies View Related

How To Update Date Field In Access2000 ..??

Feb 9, 2006

Hi All :)

Can any one help me to get this done. Here is my case ..

There is column1 called as "Status" in a table "Company List".
There is column2 called as "Date" in a same table "Company List".

My requirement is ..

Whenever I update column1 "Status" as "Done" and move to next Row. Column2 "Date" should update automaticaly with system date.

Can any one please help me in this reagrd.

Thank you in advance..!

Narayan

View 4 Replies View Related

Forms :: Returning Difference Between Date / Time Values In HH.MM Format

Dec 11, 2013

I want to be able to display the result of a difference between Date/Time values in "HH.MM" format (i.e. yes I want the result in decimals and I don't want Access to round up or down just because it feels like doing it!). I have used the following:

Example 1:

Dim ActualManHours as Long
ActualManHours = (txtEndTime.Value - txtStartTime.Value) * 86400
txtActualManHours.Value = ActualManHours

Example 2:

Dim ActualManHours as Long
ActualManHours = DateDiff("h",txtStartTime.Value, txtEndTime.Value) & "." & Format(DateDiff("n",txtStartTime.value,txtEndTime. value) Mod 60, "00")

Example 3:

Dim StartTime as Double
Dim EndTime as Double
Dim ActualManHours as Long
StartTime = CDbl(txtStartTime.Value)
EndTime = CDbl(txtEndTime.Value)
ActualManHours = EndTime - StartTime
txtActualManHours.Value = ActualManHours

View 7 Replies View Related

General :: Importing CSV With Date / Time Field In Abstract Format

Feb 6, 2013

I have a series of fairly large csv files which I need to consolidate by importing them to a single Access database. There are of the order of 50-60,000 'lines' per csv and about a dozen different files (all comma de-limited and text-qualified with inverted commas).The problem I have is, there are several date fields within the csv which are not formatted to Access' liking. Namely <Mmm_dd_yyyy_hh:ssAM> with underscores used here to represent spaces.

So for example, today's date appears thus :

Feb 6 2013 12:00AM (i.e. two spaces between 'Feb' and '6')

And this day next week would appear thus :

Feb 13 2013 12:00AM (i.e. one space between 'Feb' and '13')

I will obviously need this field recognised as Date/Time so I can query appropriately but I have no control over the source data and need to find a way of converting the format.One option would be to run a script on the csv's themselves prior to importing but I'm not sure how to do that.import this field as Text and then edit the contents after import (VBA?), such that the field can be redesignated with a data type of Date/Time.

View 3 Replies View Related

Problem Converting Date Stored As Text To Data/time Format

Sep 9, 2005

I have a problem converting text to a real date value so I can do some calculations. I have a query that brings in data from an external data source. It appears the data is stored in the external table in text format and looks like this:

20050902 15:40:41

I have tried CDate to convert the text to a date/time format, but no luck. Any ideas?

View 5 Replies View Related

Tables :: Export Table In Spreadsheet Format Automatically At Given Time Or Date?

Sep 23, 2013

I have a simple and small database having only one table. I want the data table to be exported in a spreadsheet format automatically at the end of the month. Is there any code or function to do that?

View 1 Replies View Related

Time Format - Short Time Displayed As Medium Time

May 23, 2006

I have an application with a backend db on PC 1, and the same application on PC 2 linked to the backend db on PC 1 via the network.

The link works fine but the time formats are different.

On PC 1 the time format is shortime and displays as it should i.e. in 24 hour clock format

However on PC 2, opening the same database via the network, the time format is still shorttime but when you read the time within the code it comes out in AM/PM format. Also, when the defaul tiem should be #20:00:00# but this changes to #8:00:00 PM#

Weirdly though, when you just open the table, the times are in the correct shorttime format.

Guessing, it must be a setting within the main core of Access 2003 that is different between the 2 instances?

Any ideas?

This screen shot may help:

View 2 Replies View Related

Time Format - Short Time Displayed As Medium Time

May 23, 2006

I have an application with a backend db on PC 1, and the same application on PC 2 linked to the backend db on PC 1 via the network.

The link works fine but the time formats are different.

On PC 1 the time format is shortime and displays as it should i.e. in 24 hour clock format

However on PC 2, opening the same database via the network, the time format is still short time but the format is in AM/PM or medium time.

Guessing, it must be a setting within the main core of Access 2003 that is different between the 2 instances?

Any ideas?

View 1 Replies View Related

Forms :: Setting Text Box Format To Short Date And Optional Short Time

Jun 21, 2013

I want to be able to set text boxes so that if one enters a date and a time it displays in the format "dd/mm/yyyy hh:mm", but if one just enters a date is displays in the format "dd/mm/yyyy". Is this possible?

Stipulating "dd/mm/yyyy hh:mm" means that when you just enter a date it adds "0" values for the time e.g. entering "21/6/13" gives "21/06/2013 00:00".

General Date allows for an optional time, but it means that when you do enter a time it gives you seconds as well "dd/mm/yyyy hh:mm:ss" - and I don't want that.

View 7 Replies View Related

Hard Code TIME To Selected Date On Form (to Make It Date&time) For My Query Criteria

Aug 17, 2006

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

View 10 Replies View Related

Qry Nested If's And Date Formats

Jul 11, 2007

I'm tring to build a queary based on a field called "PLAN_CODE" and a policy issue date field. There are 3 plan codes ...select1, select 2 and select 3.
I want to pull information as follows
Select1 has an issue date 11 months ago (day the queary is ran)
select2 has an issue date 23 months ago
select3 has an issue date 35 months ago

I built a field to calculate the duration of the policy based on the issue date
Duration: (Round((POLICY_ISSUE_DATE]-Date())/365,1)). I think the format is wrong? need help with that!

I built a field to create a nested "IF" statement but the first "IF" is not pulling correctly, so I cant built the remaining "IF" statements.
Expr2: IIf([PLAN_CODE]="SELECT01N" [Duration]=-0.9,0).

Anyone have a better approach? Any input how to handle this? I'm not real good with VB code but have a general understanding of it. It's easier for me to build in the QBE.

View 2 Replies View Related







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