I have Access from Microsoft 365 and havinga query problem

Anonymous
2025-05-25T01:04:49+00:00

I have Access from Microsoft 365, I am creating a query, and when I try to save it the error:

Characters found after end of SQL statement.

I have tried to find the error and can't run a debug because it hasn't been saved. How can I debug to find the error?

This SQL statement converts the signal-hour fields into universal UTC military time.

Please delete my post. I am taking another option. Thank you all for your help. I need more education in Access before taking on this type of project.

Thanks again, Jerry

Microsoft 365 and Office | Access | Other | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

22 answers

Sort by: Most helpful
  1. Anonymous
    2025-05-27T14:08:05+00:00

    I've been looking further into the question of UTC.  Firstly, I'd got unnecessarily fixated with the local time where the function is called, and, thinking about that a bit more I realised that it's not necessary to pass the current time zone where the code is being executed into the function.  It's implicit in the value returned by the Now() function, so the function to return the UTC for any given date/time in any given time zone can be simplified to: 

    Public Function Local2UTC(dtmLocal As Date, TimeZone As Single) As Date

        Dim dtmDifference As Date   

        ' get difference between local date/time and UTC

        dtmDifference = Now() - GetUTC()   

        ' convert local date/time to UTC by subtracting difference from local date/time

        ' and adjusting for time zone in which local date/time value is located

        Local2UTC = dtmLocal - dtmDifference - TimeZone / 24   

    End Function

    However, this assumes that adjustments for daylight saving time are the same internationally, which isn't the case.  Some countries don't implement daylight saving time or equivalent at all.  Others do not start and end daylight saving time on the same dates internationally.  The USA and UK end it a couple of weeks apart each year for instance.  Consequently, the above function will not always provide the correct result if the time zone is defined solely by the difference between local standard time and UTC.  It would be possible to amend the function by adding an argument, to indicate whether daylight saving time is currently in use in the target time zone or not.  I don't think it would be necessary to do the same for the time zone in which the code is being executed, as the Now() function's return value takes daylight saving time into account.

    0 comments No comments
  2. Anonymous
    2025-06-02T13:55:06+00:00

    I've now addressed the issues raised in my last reply here, and have added a little demo file to UTC.zip in my Dropbox public databases folder at: 

    https://www.dropbox.com/scl/fo/0scigd3r48hx5xrev2jrf/AB0-GMdTgMAO5O1cGdr3QW0?rlkey=ib6bs6g9jqcrywwzivur3265t&dl=0 

    This little demo file includes a TimeZones table in which the UTC offset and the start and end dates of Daylight Saving Time (DST), if any, for each year are entered.  The UTC for any local time in any time zone in a specified year can then be computed in a form using an expanded version of the function I previously posted, now using the data in the TimeZones table to take account of the DST dates, if any, for the selected time zone. 

    When the Continue button in the opening form is pressed, 6 instances of a form are opened in a Collection, enabling UTC values for up to 6 different time zones and/or local times to be computed and compared.

    0 comments No comments