Skip to content
Advertisement

Modify a query recordset to complete information (MS Access)

im working in a project in Microsoft access to query the date, hour and a quantity of products by line of production. However, I need to display all of the 24 hours of production in a column but cannot do it since I don’t have records for the missing hours. I’m using Totals to sum the quantity of products produced.

Is there a way to add the missing hours to my query if I lack of records? Or maybe doing it another way?

I have tried making a table with the hours (Table: Horas) of the day and making a relationship to display all hours and left in blank the other missing fields. It didn’t work

This is my query:

The If statements will change the [Plan Lineas] field to a value of 0 if it’s Friday between 5 and 6pm, Saturday between 4 and 8pm or Sunday. (I know it’s messy, and will try to reduce it in the future).

“Consulta” is a query where I made some calculated fields from various tables.

This is my first time using Access, and started looking if there’s a way using VBA,. So any help or guidance I will appreciate it.

Advertisement

Answer

You can join to a derived table of totals for 24 hours.

Beware DST shifts in the times of shift changes!

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement