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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare Dates and display msg box

Status
Not open for further replies.

gal4y

Technical User
Dec 24, 2001
72
US
I have a query/report that lists conferences, startdate, enddate, location and attendees.

1.Either delete the start and end dates if the dates are greater than the current date or bold/red font if the dates are greater than the current date.
2.Then have a popup msg box appear when access opens to warn the user that a specific conference has passed.

The final report should have either blank date in the startdate, and enddate fields or bold/red font on the dates.

Is there also a way to have a msg box tell the user how many days the soonest conference is and display the start date and location.

Thank you

Greg
 
Well part one shouldn't be hard. In the Format Event for the section the dates are in put this

If Me.StartDate > Date() Or Me.EndDate > Date() Then
Me.StartDate.FontWeight = 800
Me.EndDate.FontWeight = 800
Me.StartDate.ForeColor = vbRed
Me.EndDate.ForeColor = vbRed
Else
Me.StartDate.FontWeight = 400
Me.EndDate.FontWeight = 400
Me.StartDate.ForeColor = 0
Me.EndDate.ForeColor = 0

End If

As for the message boxes, it depends on when you want to see them. You could create a function that checks the dates of the fields and sets up a message box that tells the user the dates have passed, but it would run as the Report was opening and that might not be what you want. You could also add a label to the Report that would display a message based on the value of the Date field. Something like
THIS CONFERENCE HAS PASSED

or

THIS CONFERENCE IS STILL OPEN

As for the next available date, you could write a Function that would calculate the next available date and flag it so you could change the fore color to Blue or something. If you want something like this let me know and someone can probably write the Function.

Paul
 
Is there a way to put it into a macro to run when access is opened??

Thanks for your help on the first part.
 
If you are asking about the code, I don't think a macro will handle it. The code needs to go into the On Format Event and there's no equivalent in a Macro that I know of.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top