Access VBA: Date function not working - excel

I have a button on a form that displays the current date. Very simple code:
MsgBox DATE
This worked for several months, but after some seemingly unrelated changes this stopped working and I get the error: run-time error '2465': Can't find the field "DATE' referred to in your expression.
Clearly, Access stopped recognizing DATE as a function, and is trying to find it as an object that doesn't exist. DATE() is immediately replaced by DATE by Access in the VBA code.
None of the objects in the form are named Date and none of the fields in the control source table have the name Date so I don't know why Access is confused.
When I create a new form with a button and the same code it works. Any ideas?

Try this:
MsgBox VBA.Date
It should point Access to the VBA built-in function instead of some field called DATE.

Date is a data type ... use the Now method

Related

How to find a difference between time and prompting a message in case of a blank cell

Here I need to try to find the difference between the created date and the initial approval. I've tried the following formula
=IFERROR(IF(IF(AND(ISBLANK(B3),ISBLANK(C3)),"Enter dates"), IF(ISBLANK(B3),"Enter Created date"),IF(ISBLANK(C3),"Enter Initial Approval date",IF(C3<B3,"Enter correct date",C3-B3))),"Dates are Missing")
When the created date cell is blank, the formula is not prompting the error message.
Can anyone please help me?
This works for me:
=IFERROR(IF(AND(ISBLANK(B3),ISBLANK(C3)),"Enter dates",IF(ISBLANK(B3),"Enter Created date",IF(ISBLANK(C3),"Enter Initial Approval date",IF(C3<B3,"Enter correct date",C3-B3)))),"Dates are missing")
The following one also:
checks if one or both reference are returning error and if so it checks if it's a reference error of another kind of error and report the missing reference/s or the erroneous reference/s;
cheks if one or both reference have numbers inside of them, otherwise it returns the invalid reference/s.
=IF(AND(ISERROR(B3),ISERROR(C3)),IF(AND(ERROR.TYPE(B3)=4,ERROR.TYPE(B3)=4),"Dates are missing","Erroneous dates"),IF(AND(ISBLANK(B3),ISBLANK(C3)),"Enter dates",IF(ISBLANK(B3),IF(ISERROR(C3),IF(ERROR.TYPE(C3)=4,"Initial approval date is missing","Erroneous initial approval date"),"Enter Created date"),IF(ISBLANK(C3),IF(ISERROR(B3),IF(ERROR.TYPE(B3)=4,"Created date is missing","Erroneous created date"),"Enter Initial Approval date"),IF(AND(ISNUMBER(B3),ISNUMBER(C3)),IF(C3<B3,"Enter correct date",C3-B3),IF(ISNUMBER(B3),"Invalid initial approval date",IF(ISNUMBER(C3),"Invalid created date","Invalid dates")))))))

Resetting a DateTime-field with invalid data, programmatically

In Dynamics CRM 365:
I'm coding a plugin for a workflow, that's supposed to set a DateTime-field to a given date. The code works fine, unless the field ALREADY contains the value '31-12-9999'.
Every time I try to Update the entity's field with a new DateTime-value I get the following error:
The date-time format for 9999-12-31T23:59:59-00:00 is invalid, or value is outside the supported range.
The format isn't a problem, seeing as it works fine with any other date. I know for a fact the problem is because of the 31-12-9999 in UTC.
As soon as I try to access the field, it tries to convert it to GMT+2 (local timezone) and fails.
The question:
Is there a way to force delete/update the value in a field through a coded plugin?
I have tried with the normal organizationservice CRUD-operations but none of them work.
This should help or give ideas
https://community.dynamics.com/crm/f/117/t/237525
"the date format used for those fetch conditions has to match the date format configured for that user in CRM"

Spotfire: To create Slider in Text Area

I have an date property for which I have created an document property as StartDate and EndDate, and in SQL query the same will be used to filter. In the Text Area , I am using it as Control Type: INPUT Field as this has two different values for start date and end date (as shown in fig: ), I need to merge this two date property into single Slider Control Type. I tried to use Functions using formula "First(DateProperty)". However I am not successful . Can someone help me on this?
I just found the reason for the issue as well, below are two points. i May be wrong as well:
1) To create an slider calendar, we need to create a function. This function will show the data tables which are of from different connections and In our analysis we have single connection and table for Each components .Due to this we are getting error called Cyclic Dependencies and Function is not working.
2) Next to create a simple table having only date property also causing problem as even this should be an Imported table and not linked to the external databases.

How to get the Current Date & Time Automatically to a Date Time Field

I have created a date time field I made today's date as the default value, Then I added it to a page layout and created a page, But the current Date Time is not picking up from the system.
I dont want to give the user to select a Date Time instead it should populated automatically
Is there anyway to achieve this without writing code in code behind files?
This is very similar to this question I think
SO - How to get Date and current time from the Date/Time column in SharePoint Custom list
My answer there gives a few options such as using the built in Created field, using a calendar template, a JavaScript hack and a custom field type.
Guys, fake [Today] trick worked for us - but prob is we only got the date value not datetime.
Janis, is it possible to get date and time both from the fake [today] column trick? pls refer few articles on the same
Does [Today] work?
If you have language pack applied to SharePoint, then you must use localized "Today" string.

Modx assign default date to template variable

I have a template variable of input type date but I'd like to have a default value of the current date at the time the document was first saved.
I've noticed that using the date formatter widget gives an option to "If no value, use current date" however it seems to use the date at the time it is being viewed rather than the date at the time the document was created.
Any help appreciated.
I think the only way to get the date when the article was saved for the first time is to use [ * createdon * ]
If there is a way to add the created date to a TV, I am not sure. I think your best shot would be to see if you have an event that you could "hook" you Template Variable, and then use the createdon variable everytime the article is saved! I am not sure this works, but This could be a possible!

Resources