Access formula for calculating part round-trip part one-way mileage

Robbie Doo 65 Reputation points
2026-08-27T14:56:58.9266667+00:00

I need help with a formula to calculate the rate for part one-way and part round-trip travel.

For example; I have a group of 4 riders traveling from A to B and B to A, however, one of the riders decided not to take the return route. So there were 4 going and 3 coming back.

The formula I have calculates more rate for the one way rider than the rest of them. Why's that?

Help is appreciated.

Microsoft 365 and Office | Access | For business | Windows
0 comments No comments

Answer accepted by question author
George Hepworth 23,120 Reputation points Volunteer Moderator
2026-08-30T23:23:02.67+00:00

My previous suggestion applies. Add TravelType to the WHERE clause to segregate the calculations.

It's not clear whether you have a properly designed table with a Foreign Key for TravelType, or if you used a MultiValue field with those three values in it for TravelType. Either way, the parameter form will have to provide a control that allows you to indicate which one you want to calculate on.

Another option could be to add it to the query's SELECT and GROUP BY clauses. That would return all three.

EDIT: I made a mistake. I think this is the right syntax.


SELECT DailyCarPoolers.PU_Dt, DailyCarPoolers.TravelType, Count(*) AS DailyCarPoolerCount
FROM (SELECT DISTINCT PU_Dt, Carpooler, TravelType
FROM tblTravelRoute 
WHERE PU_Dt BETWEEN Forms!frmParameter01a!txtStartDt AND Forms!frmParameter01a!txtEndDt  AND PU_Loc = 2)  AS DailyCarPoolers
GROUP BY DailyCarPoolers.PU_Dt, DailyCarPoolers.TravelType;

Was this answer helpful?

1 person found this answer helpful.

2 additional answers

Sort by: Oldest
  1. Roebe Ta 1,025 Reputation points Independent Advisor
    2026-08-27T15:21:14.1833333+00:00

    Hello @Robbie Doo,

    Good day! I hope you are doing well.

    To help provide the most accurate and effective solution for your issue, could you share a bit more detail about your setup:

    • What version of Microsoft Access are you using?
    • Is the calculation being performed in a table, query, form, report, or VBA code?
    • Could you provide the exact formula or expression that is calculating the mileage rate?
    • What are the names of the relevant tables and fields involved in the calculation?
    • Could you share a few sample records (with any sensitive information removed) that demonstrate the issue?
    • How are you determining which riders are round-trip and which are one-way?
    • What result is the formula currently returning, and what result were you expecting instead?

    If possible, please include screenshots of the table design, query design, or the SQL statement used for the calculation.

    This additional context will help us better understand how the data is structured and allow us to recreate the scenario on our side to identify why the one-way rider is being charged a higher rate than expected.

    Looking forward to your response so we can get this sorted out for you together.

    Was this answer helpful?


  2. Duane Hookom 26,935 Reputation points Volunteer Moderator
    2026-08-27T15:31:19.71+00:00

    It would help if you provided the formula(s) you are using. If they get complex, I would create a user-defined function that would perform the calculations, allow comments, and enable stepping through when testing.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.