This is probably a pretty simple question:
I have written code that checks for missing records for days in the month (there SHOULD be a record for every day of the month)
At this point it concantenates a variable string and then returns that result via a msgbox. What I want to ultimately do, rather than show it in a msgbox, is to write each value to a table, for later report generation.
Let's say the table name is tblMissingDays
Here is my code:
Public Sub DetectGaps()
Dim Response As Variant, DayValue As Variant, DaysInMonth As Integer, MissingDates As String, StoreNo As String
StoreNo = "01"
DaysInMonth = DLookup("DaysInCurrentMonth", "[Current Month]"
'Lookup to see how many days in current month
DayValue = 1 ' Start with day one and increment below code for each day in month
Do While DayValue < DaysInMonth
If DCount("[StoreNumber]", "[01 List Dailies Dailies]", "Day([DailyDate])= " & DayValue & " and StoreNumber = '" & StoreNo & "'"
= 0 Then MissingDates = MissingDates & " " & DayValue
DayValue = DayValue + 1
Loop
Response = MsgBox("The following dates were missing for store #" & StoreNo & ": " & MissingDates, vbInformation, "Missing Dates"
End Sub
I have written code that checks for missing records for days in the month (there SHOULD be a record for every day of the month)
At this point it concantenates a variable string and then returns that result via a msgbox. What I want to ultimately do, rather than show it in a msgbox, is to write each value to a table, for later report generation.
Let's say the table name is tblMissingDays
Here is my code:
Public Sub DetectGaps()
Dim Response As Variant, DayValue As Variant, DaysInMonth As Integer, MissingDates As String, StoreNo As String
StoreNo = "01"
DaysInMonth = DLookup("DaysInCurrentMonth", "[Current Month]"
DayValue = 1 ' Start with day one and increment below code for each day in month
Do While DayValue < DaysInMonth
If DCount("[StoreNumber]", "[01 List Dailies Dailies]", "Day([DailyDate])= " & DayValue & " and StoreNumber = '" & StoreNo & "'"
DayValue = DayValue + 1
Loop
Response = MsgBox("The following dates were missing for store #" & StoreNo & ": " & MissingDates, vbInformation, "Missing Dates"
End Sub