Ask Your Question
0

How can MS Access display the number of occurrences where a value in one field is followed by another value in a different field within a specified time frame indicated by a separate date/time field on the table?

asked 2021-10-26 11:00:00 +0000

huitzilopochtli gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-04-26 17:00:00 +0000

lakamha gravatar image

To display the number of occurrences where a value in one field is followed by another value in a different field within a specified time frame indicated by a separate date/time field on the table, you can create a query using the following steps:

  1. Open the MS Access database and go to the "Create" tab.
  2. Click on "Query Design" and select the table that contains the relevant fields.
  3. Add the fields to the query design grid including the fields for the values being compared and the date/time field.
  4. In the Criteria row for the date/time field, enter the desired time frame.
  5. In the next column of the query design grid, create a calculated field using the "IIf" function to compare the values in the two fields being compared. For example, if the fields are named "Field1" and "Field2", the calculated field might look like:

Occurrence: IIf([Field1]=[Field2],"Yes","No")

This will create a new field called "Occurrence" that contains the value "Yes" if the values in the two fields are the same and "No" if they are different. 6. Run the query to see the results, including a count of the number of times that the values matched within the specified time frame. 7. You can further refine the query results by sorting and filtering the fields as needed.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-10-26 11:00:00 +0000

Seen: 17 times

Last updated: Apr 26 '22