filtering date column that contains strings as well in MS Access - ms-access

Good Day,
i have an MS Access DB that has 1 column that contains dates and strings (in different cells). my question is if it is possible to filter by date as date while keeping the strings? the column looks like this:
Date_Col
01/05/15
05/04/18
Not Released
01/01/18
Not Released
this is data from hardware EOL so we need to keep the dates and the strings but we need to have the ability to filter or sort the dates as we wish.
any help would be appreciated as right now when i am trying to filter the column is treating everything as text but if the column was in excel it will filter by date and ignore the strings cells.

You can use a query where you convert that text field to a true date value:
Select *, CDate([Date_Col]) As TrueDate
From YourTable
Where IsDate([Date_Col])
Now, filter on field TrueDate as you like.

Related

MS Access Calculating date differences if Dates are Short Text

Is is possible in a Table to Calculate differences between Dates if the Value in the field is considered "short text"?
I am working to convert an Excel macro database into Access one and I have imported the data from the Excel file into an Access Table.
however i realized 2 feilds that count up until closure are now just fixed numbers but need to add up as each day passes until closure
when i imported the Dates became Short Text.
is there an expression that would handle this situation?
Each record has a serialized non repeating ID number seperate from access as well.
Dates I have are
OfficialissuanceDate,
DatePlanSubmitted,
DatePlanCompletedSubmitted,
DateClosed,
I need 2 calculations that increments daily when DateplanSubmitted and DatePlanCompletedSubmitted are null
Both comparing to OfficialIssuanceDate. then stop counting when they are no longer null. (have a date in updated to the record) and retain the value.
I have tried to Google calculating Dates but i get DateDiff function which doesnt appear to work. I've used Access and taken a class on it but never really made a new DB from scratch
Dates in a text field are not actual dates, just strings of characters. A Date/Time field stores value as a double number then displays in a date structure - "dd/mm/yyyy" is Access default structure.
Sometimes Access will do implicit conversion of data but not in this case. Either change field type to Date/Time or do conversion with CDate() function. However, you will find that conversion functions error with Null input.
Arithmetic operation with Date/Time field type is possible. However, arithmetic when any term is null returns Null so have to deal with that. One way uses Nz() function: Nz([DateClosed], Date()) - [DateOpened]. Unfortunately, Nz() is not available in table Calculated field type, so do that calc in query or textbox. Most developers avoid table Calculated field type. If you really want to use, expression would have to be: IIf(IsNull([DateClosed), Date(), [DateClosed]) - [DateOpened].

Transform the field values pentaho(kattle) and store it in standard format in any table

I want to transform the value of fields name and Date using pentaho(kattle) and store it in standard format in any table.
For example
id,name,f_n,Date
1,j_vick,03-05-2015
2,jo_vick,04,08,2016
3,Arn_jonnn_vick,05,07,2017
Now I want to transform it using pentaho(kattle) IDE and store it in data base like below:
id,name,Date
1,john_vick,03/05/2015
2,john_vick,04/08/2016
3,Arn_john_vick,05/07/2017
I don't want the transformation steps concern with extraction database storage.
The date format is just some clothing of a value. Just read it with Kettle and store it as is. The database will store it in its proper internal binary format anyway.
Unless, you have to store them explicitly as varchar. In that case, use the Metadata tab of the Select Value step. Define your column as Date and specify the format as dd/MM/yyyy or MM/dd/yyyy. It will be kept internally as a Date, and converted into a String with the selected format at the last moment.
You also seam to have an other problem: the day, month and year are in three columns. The easiest way is to use a Modified Java Script Value step, in which you define a new column date = new Date(year, month, year), with type Date, and let Kettle handle with the format.
Maybe you have mixed input, in which case you can use a Filter or a Swtich step, based on weather you have something in the day and month column.
When that is done, you can make a job that runs the transformation on all the tables. You have an example in the sample/jobs/process all tables furnished with the Pentaho Data Integrator (aka Kettle).

Conditional Formatting in Access wwith Dates

I'm having an issue with conditional formatting in Access where I need to format a value if the date occured before today and another field is blank. It works fine for most values, but for some reason when the day value is in the single digits of the current month, or you go two months ahead the value isn't read properly.
The Date on the left is referred to as [Plan_Date] and the column on the right is referred to as [Act_Date]. The premise is that if [Act_Date] is blank and [Plan_Date] occurs before today then the field should be highlighted. I'm using the expression:
[Act_Date]="" And [Plan_Date]<Date() in my conditional formatting.
The problem is that [Plan_Date] is being treated as a string and forcing an alphabetical order comparison between [Plan_Date] and Date(). The following strings are sorted in ascending alphabetical order:
11/15/2014
8/12/2014
8/25/2014
8/3/2014
You need to force [Plan_Date] to a date type for comparison purposes:
[Act_Date] = "" And CDate([Plan_Date]) < Date()

How can I sort by date in ms access 2007?

Just want to know how do I sort a text column that shows data in date format mm/dd/yyyy.
You will first have to convert to a date to get a proper sort. This is a query that converts Datetext to RealDate, and then sorts on that column (field). You can also click the header to choose the sort order.
SELECT
t.ID,
t.Datetext,
DateSerial(Mid([Datetext],InStrRev([Datetext],"/")+1),
Mid([Datetext],1,InStr([Datetext],"/")-1),
Mid([Datetext],InStr([Datetext],"/")+1,
(InStrRev(Datetext,"/")-InStr([Datetext],"/"))-1)) AS RealDate
FROM Table t
Order By 3
You can use IIf to avoid errors from null:
IIf([Datetext] Is Null,Null,DateSerial(
Mid([Datetext],InStrRev([Datetext],"/")+1),
Mid([Datetext],1,InStr([Datetext],"/")-1),
Mid([Datetext],InStr([Datetext],"/")+1,
(InStrRev(Datetext,"/")-InStr([Datetext],"/"))-1))) AS RealDate
In a comment you said this is a "text column displaying date from a sql table". I'm unsure what you meant by that, but I think the situation could be simpler if you can convert the text column to an actual Date/Time column.
If you're importing data from SQL Server into Access, convert those text values when you pull them in to Access.
If the Access table is a link to a SQL Server object, create a view in SQL Server which casts the text date column to an Access-compatible date type. Then on the Access side, replace your existing link with a link to the view.
If you need to edit the date values in Access, not just display and sort them, include both the original text column and the transformed date version in your view. Do your Access edits to the text column; sort on the Date/Time column.

how do i make addition of two fields in ssrs expression?

I have generated one ssrs report
now i have two fields having values
1st field value is =Fields!FirstNO.Value
2nd field value is =Fields!SecondNO.Value
now i have one field average and i need to write expression like
average = (Fields!FirstNO.Value+Fields!SecondNO.Value) / (Fields!SecondNO.Value)
how can i write above in expression?? directly as i shown or any other syntax is there please help?
Are you sure these fields are numeric? Maybe try convert to numeric, like =cint(Fields!FirstNO.Value)