So i have a query that is suppose to get me data from two tables. Which works fine so long as the date format is under the english(us) locale. When it is in an international formating the query gets an error when run and fails. the query is
SELECT DISTINCT AlarmDet.Machine, AlarmDet.Job,
AlarmDet.Mode, AlarmDet.User, AlarmDet.JobStart,
AlarmDet.Object, AlarmDet.AlarmId, AlarmDet.AlarmStart,
AlarmDet.MachineFault, AlarmDet.OperFault,
AlarmDet.PiecesFed, Val(OperFault)+Val(MachineFault) AS AlarmStopTime,
(Mid(alarmdet.AlarmStart,5,7) & Right(alarmdet.AlarmStart,4) & Mid(alarmdet.AlarmStart,11,9)) AS AlarmTimeDate,
Mid(alarmdet.AlarmStart,12,2) AS AlarmHH,
Mid(alarmdet.AlarmStart,15,2) AS AlarmMM,
Mid(alarmdet.AlarmStart,18,2) AS AlarmSS,
CVDate((Mid([alarmdet].[AlarmStart],5,7) & Right([alarmdet].[AlarmStart],4))) AS AlarmDate, Alarms.ALARM_DESC
FROM AlarmDet INNER JOIN Alarms ON AlarmDet.AlarmId = Alarms.id;
What the formulas in the query are doing is taking alarmstart (date) and splitting it up into seperate segments.
The section of the query that is causing an error when i step into it and attempt to run it is this:
CVDate((Mid([alarmdet].[AlarmStart],5,7) & Right([alarmdet].[AlarmStart],4))) AS AlarmDate
What i would like to know is, if there is a way in access to convert the formating of the query to be turnned in to US dateformating? Or is there a better way to structure this part of the query in order to get it to run under an international formating?
Update
after spending some time and trying some of your suggestions, i've come up with this:
format(Mid([alarmdet].[AlarmStart],5,7) & right([alarmdet]![alarmstart], 4), "mm/dd/yyyy")
However, instead of getting mm/dd/yyyy, i get this: mm-dd-yyyy.
Any thoughts as to why that is?
Update: again...
Nevermind, it appears that, that has to do with where your locale is set to.
Any suggestions or help is greatly appreciated.
Thanks.