Ashfaque
Search Beautiful Girls from your town for night
- Local time
- Today, 23:50
- Joined
- Sep 6, 2004
- Messages
- 897
Hi,
One of column of table contains dates of the month. This data with some other columns, we are exporting to a pre-designed formatted Excel sheet.
01/08/2016
02/08/2016
03/08/2016
04/08/2016
05/08/2016
08/08/2016
09/08/2016
….
….
30/08/2016
31/08/2016
My question is : if some dates missed / are not available (with complete record set) in the access tbl but while exporting Excel, we want to check them if next date after current record is no available, it should generate following date adding 1 day to current record set date.
Example.
After 05/08/2016 there are 2 dates not available in table and the next available date is 08/08/2016.
In this case, we would like to generate 06/08/2016 and 07/08/2016 and export them to excel sheet. The same situation arise with some other date. The purpose is to export all dates data from 1st to 31st or till end of the month even if there are less dates available in the table.
different Code lines to open excel application here……
….
…
Do While Not rst.EOF
Here some other code lines of IF THEN
….
IN between of my lengthy code I tried to check thru below code lines if I could generate the date that is not available in the table but it is not working. I don’t know if the trick is the right way to do it.
Code Tags Added by UG
Please use Code Tags when posting VBA Code
https://www.access-programmers.co.u...e-use-code-tags-when-posting-vba-code.240420/
Please note f.time is a lenthy format like 03/08/2016 07:54:00 AM. Therefore we shortened it to compare only.
Any help shall be appreciated...
Thnaks,
One of column of table contains dates of the month. This data with some other columns, we are exporting to a pre-designed formatted Excel sheet.
01/08/2016
02/08/2016
03/08/2016
04/08/2016
05/08/2016
08/08/2016
09/08/2016
….
….
30/08/2016
31/08/2016
My question is : if some dates missed / are not available (with complete record set) in the access tbl but while exporting Excel, we want to check them if next date after current record is no available, it should generate following date adding 1 day to current record set date.
Example.
After 05/08/2016 there are 2 dates not available in table and the next available date is 08/08/2016.
In this case, we would like to generate 06/08/2016 and 07/08/2016 and export them to excel sheet. The same situation arise with some other date. The purpose is to export all dates data from 1st to 31st or till end of the month even if there are less dates available in the table.
different Code lines to open excel application here……
….
…
Do While Not rst.EOF
Here some other code lines of IF THEN
….
IN between of my lengthy code I tried to check thru below code lines if I could generate the date that is not available in the table but it is not working. I don’t know if the trick is the right way to do it.
Code Tags Added by UG
Please use Code Tags when posting VBA Code
https://www.access-programmers.co.u...e-use-code-tags-when-posting-vba-code.240420/
Code:
Dim AdvDate, CurrentDate As Date
CurrentDate = Format(Left(rst![f.time], 10))
AdvDate = DateAdd("d", 1, TempDate)
rst.MoveNext
If Format(Left(rst![f.time], 10)) = AdvDate Then
'CurrentDate = rst![f.time]
'rst.MovePrevious
MsgBox "Next date available"
Else
MsgBox "no next date"
End If
Other code lines here…
Rst.MoveNext
Loop
Any help shall be appreciated...
Thnaks,
Attachments
Last edited by a moderator: