Hi All
I have a field formated to date I would like to be able to enter a date and when this date matches datenow I would like to see a Msgbox pop up.
is this possible please.
Braddy
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » MsgBox (Access 2003)
You should do this on a form based on the table. You can write code in the After Update event of the text box bound to the date field:
Private Sub txtDateField_AfterUpdate()
If Me.txtDateField = Date Then
MsgBox “You entered the current date!”, vbInformation
End If
End Sub
Or do you mean that you want to enter a date in the future, say 20 December, and you want a message box to pop up if you open the database on 20 December? If so, what if you don’t open the database on 20 December, but you do on 22 December?
If you look at the code, you will see that you have nested an Ater Update procedure inside another After Update procedure: there are two lines with Private Sub below each other, and two lines with End Sub below each other. You should have only one of each. Keep the Private Sub line with the correct name of the control.
Hi Hans
Thank you for your continued patience, So far it only happens when I actullaly enter the date, I would like to see the message each time I go to the record.
If you understand each time I go to a record for a client it will tell me I need to call him back. I hope this is clear.
Thanks
Braddy
Do you really want to see that message again and again if you move back and forth between the records? The Current event, which is the only place I can think of off-hand to use for that, fires many times, including when you move to a record, when to change a record and save the changes, and multiple times when the form is opening.
Hi Charlotte
Your quite right I don’t want to see the message over and over again, I only want to see it when the call back field matches the date which should only be one day.
On making the the callto the cllient, the called field entry will be deleted or reset. What I am trying to achieve some similar to act or outlook where you can set a reminder to do something like call a client.
Thank you for your response I hope this is clear.
Braddy
Hi
I’m not sure which of 2 separate scenarios you are trying to fix:
1) You want to see that some action is needed when you enter a particular clients record; or
2) You want to know that action is needed when you fire up the database.
For the first, rather than fire up a message box which, as Charlotte points out, will fire multiple times each requiring action from the user why dont you provide a visible clue on the client form. For example, change the colour of the header or the date text box, or put a warning message that will be visible when appropriate and hidden when not.
For the second, you could do a search when the database opens that will find a list of all clients where action is required and present this list on a form to enable the user to select each.
I use both these techniques.
Hi David
I like both of your suggestions, unfortunaly being a novice I don’t have a clue how to do either.
I lik the idea of No 2 But I would not know where to start.
Thanks for your reply.
What I would like to do is when the database opens I would like to know who is scheduled for a call that day.
Braddy
Braddy
Perhaps a different approach will achieve what you are trying to do.
If you are going to want reminding today (Date) then when you roll to the next date, you may have a problem because today ie, Date has changed.
You can overcome this in code and it’s not difficult to do.
I’ve attached a different method by using a check box and an invisible label.
If you have called back your client, you put a tick in the check box. This will make the label invisible.
Using the current event of the form, you can make this label visible or not dependant on whether you have entered the tick or not.
The code is simple to implement:
If Me.Completed = False Then
Me.lblMessage.Visible =True
Else
Me.lblMessage.Visible = False
End If
This way, if you scroll through your form, you will see the label appear or disapear dependant on whats in the checkbox.
Braddy
Perhaps a different approach will achieve what you are trying to do.
If you are going to want reminding today (Date) then when you roll to the next date, you may have a problem because today ie, Date has changed.
You can overcome this in code and it’s not difficult to do.
I’ve attached a different method by using a check box and an invisible label.
If you have called back your client, you put a tick in the check box. This will make the label invisible.
Using the current event of the form, you can make this label visible or not dependant on whether you have entered the tick or not.
The code is simple to implement:
If Me.Completed = False Then
Me.lblMessage.Visible =True
Else
Me.lblMessage.Visible = False
End If
This way, if you scroll through your form, you will see the label appear or disapear dependant on whats in the checkbox.
Hi David
I like both of your suggestions, unfortunaly being a novice I don’t have a clue how to do either.
I lik the idea of No 2 But I would not know where to start.
Thanks for your reply.
What I would like to do is when the database opens I would like to know who is scheduled for a call that day.
Braddy
Hi
I’m not sure which of 2 separate scenarios you are trying to fix:
1) You want to see that some action is needed when you enter a particular clients record; or
2) You want to know that action is needed when you fire up the database.
For the first, rather than fire up a message box which, as Charlotte points out, will fire multiple times each requiring action from the user why dont you provide a visible clue on the client form. For example, change the colour of the header or the date text box, or put a warning message that will be visible when appropriate and hidden when not.
For the second, you could do a search when the database opens that will find a list of all clients where action is required and present this list on a form to enable the user to select each.
I use both these techniques.
Braddy
What do you see at the moment when you first open the DB. It seems to me the simplest way to do what you want is to open on a little unbound form which says “Do you want to see today’s clients?” . Have 2 buttons, one of which filters your client list by date and the other either exits or goes into some other part of the DB. I ( or lots of other loungers) can show you the code if this sounds right.
Peter
Braddy
What do you see at the moment when you first open the DB. It seems to me the simplest way to do what you want is to open on a little unbound form which says “Do you want to see today’s clients?” . Have 2 buttons, one of which filters your client list by date and the other either exits or goes into some other part of the DB. I ( or lots of other loungers) can show you the code if this sounds right.
Peter
Hi Charlotte
Your quite right I don’t want to see the message over and over again, I only want to see it when the call back field matches the date which should only be one day.
On making the the callto the cllient, the called field entry will be deleted or reset. What I am trying to achieve some similar to act or outlook where you can set a reminder to do something like call a client.
Thank you for your response I hope this is clear.
Braddy
Do you really want to see that message again and again if you move back and forth between the records? The Current event, which is the only place I can think of off-hand to use for that, fires many times, including when you move to a record, when to change a record and save the changes, and multiple times when the form is opening.
Hi Hans
Thank you for your continued patience, So far it only happens when I actullaly enter the date, I would like to see the message each time I go to the record.
If you understand each time I go to a record for a client it will tell me I need to call him back. I hope this is clear.
Thanks
Braddy
If you look at the code, you will see that you have nested an Ater Update procedure inside another After Update procedure: there are two lines with Private Sub below each other, and two lines with End Sub below each other. You should have only one of each. Keep the Private Sub line with the correct name of the control.
You should do this on a form based on the table. You can write code in the After Update event of the text box bound to the date field:
Private Sub txtDateField_AfterUpdate()
If Me.txtDateField = Date Then
MsgBox “You entered the current date!”, vbInformation
End If
End Sub
Or do you mean that you want to enter a date in the future, say 20 December, and you want a message box to pop up if you open the database on 20 December? If so, what if you don’t open the database on 20 December, but you do on 22 December?
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications