> Each day a user is supposed to import a list of information into a
> database table. The user only has 30 days to import this information.
[quoted text clipped - 23 lines]
>
> Thanks
In the form that calls the query (I'll assume you call the query from a
form), I'll assume you have a FromDate (starting date) for the query.
Using a SQL statement similar to your update query (one that selects the
records, not updates) select the dates and group on date. Now loop
through the set. Aircode follows....btw, it may be 29 instead of
30...you decide.
Dim strMsg As String
Dim datFor As Date
Dim blnMissing As Boolean
Dim rst As Recordset
Dim strSQL As String
strSQL = "Select TXDate From TX Where TXDate Between #" & _
Me.FromDate & "# And #" & Me.FromDate + 30 & "# " & _
"Group By TXDate"
set rst = Currentdb.openrecordset(strSQL,dbopensnapshot)
'go through all 30 dates
For datFor = Me.FromDate To Me.FromDate + 30
rst.findfirst "TXDate = #" & datFor & "#"
If rst.Nomatch then
blnMissing = True
strMsg = strMsg & datFor & ", "
endif
next
'disable button to execute query if missing dates
Me.CommandButtonToExecuteQuery.Enabled = (Not blnMissing)
If blnMissing then
msgbox "The following dates; " & strMsg & _
" are missing. Fix first"
else
msgbox "All dates were found. You can update."
endif
Chuck Grimsby - 10 Jan 2006 00:23 GMT
Sorry for this rather late reply, Salad, but it might be faster to
execute a Count Query against the Grouped query to return how many
different dates there are. If that count doesn't equal the number of
days in the month (or number of "work days", however *that* is
determined).
That way there's no real need to walk through each record, or each
group of records for each date) unless there is a problem.
Oh, also, I'd recommend that these queries be "Stored", so that Access
can optimize them.
Ya'll Have Fun!
salad - 10 Jan 2006 03:18 GMT
> Sorry for this rather late reply, Salad, but it might be faster to
> execute a Count Query against the Grouped query to return how many
[quoted text clipped - 9 lines]
>
> Ya'll Have Fun!
Good solution. Yes, yours would be quicker. With mine I wanted the
user to see what dates were missing if there were any and I didn't see
any obvious way by determining them except by looping thru the list.