Access 2007 Textbox Date Formatting - ms-access

I converted an older Access app to 2007, and now the date formatting in editable textboxes is not working. The format I'm using is mm/dd/yy, but the date is displaying with a 4-digit year.
I've tried other formats just for testing, eg mmm/d/yy - they display correctly except for the year which insists on being 4 digits.
This appears to be a new 'wrinkle' in A2007 - has anyone found a way around this?

I see something different on my system. With an ACCDB format database and a textbox format set to mm/dd/yy, today's date displays as 10/03/10.
It appears that if the checkbox for "Use four-digit year formatting" for "This database" is checked, Access uses 4 digits for the year regardless of the control's format property. To find that setting, click the Office Button, then Access Options -> Advanced and scroll down to the General heading.

Related

Access DatePart function will not give the correct week number when used in a tabular form text box Control Source

I am attempting to create a tabular form in Access that lists the date and week number for each record. When I use the Format option in the textbox property sheet (ww), my weeks are off by 1 week (the week of Dec. 19, 2021 is considered week 52). I have been able to correct this in an unbound field in the header using VBA
DatePart("ww", Date, vbSunday, vbFirstFourDays)
but I can't get the same code to work in the textbox Control Source for the tabular form. I can get the same wrong week 52 answer using:
=DatePart("ww", [dtmEventStartDate])
but both of the following give me a "#Name?" error in the text box when the form loads:
=DatePart("ww",[dtmEventStartDate],[vbSunday],[vbFirstFourDays])
=Format([dtmEventStartDate],[ww],[vbSunday],[vbFirstFourDays])
Oddly, the pop-up help for the Control Source seems to indicate that the format I am using is supported, but then it proceeds to not work. Any help would be greatly appreciated!
Access doesn't know about VBA constants like vbSunday, vbFirstFourDays and makes assumption these are field names.
Use the number values. =DatePart("ww", [dtmEventStartDate], 1, 2)

Changing the SSRS date picker format to DD/MM/YYYY

I have seen this issue posted a few times but there does not appear to be a solution for what I am seeing. I have a paginated SSRS report that requires a date input from the drop-down calendar. Upon entering, say, January 21st 2020, the UI is then displaying the date chosen as 1/21/2020, for example here. I need it to be 21/01/2020. Some points of note:
* all location settings for both the report server and the client browser are set to English (United Kingdom) and all date format settings are set to dd/mm/yyyy within the Windows settings on both the report server and client machine. All client browser language settings are English-UK in both IE and Chrome
* the variable is a DateTime data type
* this is a paginated SSRS report being displayed on a Power BI host server
* this is affecting all reports on this server
* the date field is not necessarily returned in the report, so converting the data is not applicable here.
* PBI version 15, SQL Server 2016
I have seen responses talking about expressing the field into the correct format, eg =CDate(Fields!BirthDate.Value) or =FormatDateTime(Fields!BirthDate.Value, DateFormat.ShortDate) however this does not appear to change anything (when it doesn't error).
I'm at a total loss as to where this Americanization of the date is coming from. Any thoughts?
Unfortunately, the report server's location settings and the user's browser's location settings don't (by default) do anything to the report formats because the report has its own Language property that is set by default to en-US. So unless you modify this property, you are always going to get US formats. You access this property on the report's Property panel.
Now you could set it to en-UK but a better solution is to set it to the user's internationali[s|z]ation setting by using =User!Language. Now you can use d as the cell Format property for the user's regional short date format.
Handy formats that use the user's regional formats are:
d = short date format
N2 = number with 2 decimal places
N0 = number with no decimal places
P0 = percent with no decimal places

Changing the date format in Access 2010

I want to show the Purchase_Date in dd/mm/yy format . I already set the Format in form properties as dd/mm/yy
When i select a cell in database view it shows the date in dd/mm/yy but it still shows the date in mm/dd/yy otherwise
I need 05/02/14 to show as 02/05/14 at all times
This is by design. When the control gets focus, it will revert to the default format as to the settings in Windows.
A workaround can be to use three concatenated textboxes, but it requires some code to operate nicely.
You have to go to the Region and Language in the Control Panel and choose "English (Autralia)" as the format in the formats tab. Then change the short date format from the option below as you require. The format you want is available there.
Edit:
A better way to do it is to apply your own format. In the Format property of the properties of the Date/Time field, you can type in the format you want using placeholders and separators.
Hope this solves your problem.

SSRS 2008 date formatting and exporting to excel confusion

Suppose I have a field with a date value in a Reporting Services template, e.g. =CDate("2010.12.03"), I apply the "d" format to this cell, which, according to the description, "will reflect the regional settings of the report". I generate the report using the English language, the date is displayed as 12/03/2010, which is fine. Now when I export this report to excel, I have no idea what the __ happens.
First scenario: the regional settings of the computer are set to English (United States). When I open the excel document, the value seen in the cell is 12/03/2010, as expected. When I click on it, I can see that the actual value stored in the cell is 2010.12.03, which also seems reasonable - some formatting is applied to the cell, it's not simply exported as text. But when I try to figure out what type of formatting is applied, by right clicking and checking Format Cells, I see that the format is "General", i.e. none! How can this be ? This is Excel 2010 by the way, but the file itself is .xls, of course.
Second scenario, where it gets more interesting: now the region of the computer is set to e.g. Lithuania, where the date format is 2010.12.03. I open the same document and see 12.03.2010. Now that simply does not make any sense. Exporting many times I've encountered that sometimes the cell is formatted as [$-10409]m.d.yyyy in excel (under the Custom section). What is this, what does the 10409 mean ? The weirdest part of all: if I close the document without saving, change the computer region back to English (United States), reopen the document, the format is now [$-10409]m/d/yyyy ! HOW is this possible !??
Basically the same thing happens with numbers and with thousand/decimal separators - excel uses the region of the computer to format these, but the actual format of the cell can be something like [$-10409]#,##0.00;-#,##0.00 or General - again, depending on the region of the computer, direction of wind and the temperature outside.
My question is then, first of all, what the __ is going on ? Second, how should the excel document behave according to the specs, i.e. what does the statement that a format "will reflect the regional settings of the report" in the BIDS designed, where I chose the "d" format for the date textbox, mean ? Does it mean, that the format will be determined by the language of the report and the result will look the same on all computers in the world (which makes sense, since this is how other formats behave, i.e. if you export the date to a pdf, it stays the same always) ? If not, which appears to be partially the case in excel, why doesn't the exported date cell have the regional date format, i.e. the one that you normally use in excel, the one which formats the date according to the region of the computer ?
Are these some kind of limitations of excel or what ? Why can't we have consistent behavior, i.e. either make everything sensitive to the culture of the computer viewing the document or don't, why is the actual behavior somewhere in between ?
Excel uses a custom encoding for the date, and uses the machine regional settings as a hint on how to format the contents. The encoding is archaic, and has lots of specific, historic gotchas.
This means that the kinds of bugs that you see often do happen - you'll have data that's been exported to Excel, which then has its formatting and contents mangled once opened for the first time by the actual Excel application. The problem can be anywhere along the line - maybe the library that exports the data to Excel doesn't deal with some of the more esoteric historic cases well, or maybe Excel is confusing itself along the way.
I've had some success in the past with exporting dates as a strings to a CSV file, stripped of formatting, and then importing them into Excel/opening them with Excel.
I sorted my date formatting problem by:
adding calculated fields for the dates :
=IIF(IsNothing(Fields!Date_Delivery_Confirmed.Value),nothing,DateSerial(DatePart("yyyy",Fields!Date_Delivery_Confirmed.Value), DatePart("m",Fields!Date_Delivery_Confirmed.Value),DatePart("d",Fields!Date_Delivery_Confirmed.Value)))
set cell Textbox as dateformat
how I am using *dateformats (localised) I checked my server laptop and report are set to the right language
I have aligned elements vertically in the report so it ( the visual gaps) doesn't create extra empty columns when exporting to excel. Because 2 excel columns merged to 1 date-cell will never get any format but "General format"

Date prompt in BO

I have a webi report that accepts a date input.
I need to receive data from the user in the format "dd-Mmm-YYYY"; however the calendar control that BO presents to the user for date selection is always shown in M/DD/YYYY HH:MM:SS AM/PM.
Is there any way to control this behaviour?
Have you tried changing all the date fields in the Universe designer to the format that you want? You can either format them using SQL in the select statement box of the "Object Properties", or you can change the format of the field by right clicking and selecting "Object Format..."
I'm pretty sure that would affect the way the end user sees it.
you can set the date format (and all other format ) on the locatizion parametrs on the user setting for each user you have in cms , simply by the infoview preferences for each user .
home screen of central management -> preferences - > Preferred Viewing Locale + local time zone.
or
home screen of infoview -> preferences - > Preferred Viewing Locale + local time zone.
this will set also the date prompt format
There's another option.
On the BO server there's a javascript file that is used to create the calendar popup.
..\Tomcat55\webapps\AnalyticalReporting\viewers\cdz_adv\lib\calendar.js
Inside this file there's a function called CTFB_setFormatInfo which if passed a date format uses it ... if not there's seems to be a hard coded default of "MM/dd/yyyy hh:mm:ss a".
I'm pretty certain this is not updated by the other dozen ways to set the date format found in BO (user prefs, prn file, object properties ect).
function CTFB_setFormatInfo(format,arrDays,arrMonth,AM,PM)
{
var o=this
o.arrMonthNames=arrMonth?arrMonth:_month
o.arrDayNames=arrDays?arrDays:_day
o.format=format?format:"MM/dd/yyyy hh:mm:ss a"
o.AM=AM?AM:_AM
o.PM=PM?PM:_PM
}
I just updated this file - and now I get consistent dd/mm/yyyy - without pesky mm/dd/yyyy randomly turning up when the preference isn't passed through.