Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unhide a hidden field at the months end

Status
Not open for further replies.

moles

Technical User
Jul 29, 2002
17
US
Currently I have created a form where a user will enter specific data concerning the upkeep of our systems. The system password needs to be updated at the end of the month. Currently I have a text box hidden, I want this box to appear at the end of the month. Any sugestions
 
Place the following function either at the top of your form module so it will be global to the form, or place it in a global module:


Public Function fLastofMonth() As Date
Dim nextdate As Date

nextdate = Month(Date) + 1 & "/" & Year(Date)
fLastofMonth = DateAdd("d", -1, nextdate)

End Function


Since I assume you want to test for the end of month for every record, include the following. This is of course air code which you will modify to meet your requirements

if flastofmonth = date() then
my_hidden_variable.visible = true
end if Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
The only problem I see with this is that if the last day of the month falls on a non-working day, the test will never evaluate to true. Who wants to come in to work on a Sunday just to open a database? ... LOL

The only way to accurately do this sort of thing is to STORE, in a table, the last date the password was changed. Then, in whatever manner you want, and wherever you want, compare the MONTH AND YEAR of that date, to the CURRENT MONTH AND YEAR. If table date is LESS THAN, you need to change the password. Then update the table date.

You need to check Month AND YEAR, because January is less than December, remember?

If Month(lastChangeDate) < Month(Date())
or (Month(LastChangeDate) > Month(Date()) and Year(LastChangeDate) < Year(Date()) )
Then
{ Update your password here}
{ Update the LastChangeDate here}
Else
{ just go on about your bidness..}
End if

There are other ways to check if Now is January and THEN was December, but you get the drift....

Jim
How many of you believe in telekinesis? Raise my hand...
Another free Access forum:
More Access stuff at
 
Point taken. Of course, you could check for Friday and see if Monday was next month. And let's not forget holidays falling around the end of month.

Just how complicated would he like to make this task? Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top