Re: Lookup Date Table for Mising Date
- From: salad <oil@xxxxxxxxxxx>
- Date: Sat, 07 Jan 2006 16:00:41 GMT
www.ttdown.com wrote:
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. After 30 days the information is lost. I need to be able to create a form or a report or something that a user would be able to review and show that a day was missed doing the import (indicating they forgot to import that days information).
The table the information is being imported into is called tblTransaction. One of the fields of the table is TxDate which is a date field. Each day has multiple transactions with the same date and a duplicates Ok for the TXDate field. I can run a query and get the days that have transactions and the number of transactions for that day. I use todays date and the date function that gives me today's date -30 days. Each time the query is run it is for the past 30 days. This works fine but the user has to look down to query to see if there is a missing date.
I would create a table to denote the import was done at the time of the import but sometimes the import data is for multiple days and the import is not always done on the same date as the transaction date.
I am sure there is a way to just print or display the missing days but I just cannot seem to make it happen.
Is there someone out there that would help?
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
.
- Follow-Ups:
- Re: Lookup Date Table for Mising Date
- From: Chuck Grimsby
- Re: Lookup Date Table for Mising Date
- References:
- Lookup Date Table for Mising Date
- From: www . ttdown . com
- Lookup Date Table for Mising Date
- Prev by Date: Re: a97 - problem transfer file from server with https
- Next by Date: Re: Indexing Service and Access Files
- Previous by thread: Lookup Date Table for Mising Date
- Next by thread: Re: Lookup Date Table for Mising Date
- Index(es):
Relevant Pages
|