• MsgBox (Access 2003)

    Author
    Topic
    #397945

    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

    Viewing 1 reply thread
    Author
    Replies
    • #757178

      Is datenow another field, or do you mean the current date by datenow? And what do you want to accomplish with the message box?

      • #757186

        Hi Hans

        I mean the current date, It’s client database it is so I can use it as a call back reminder.

        Thanks

        Braddy

        • #757192

          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?

          • #757194

            Hi

            I am doing something wrong can you tell me what please.

            Braddy

            • #757196

              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.

            • #757200

              Hi Hans

              I have corrected my silly mistake and now I get no error, but i also do not get the msgbox if i enter the date equal to todays date.

              Braddy

            • #757202

              In the code in your screenshot, the name of the control in the Private Sub line and in the If … Then line don’t match. You must use the real actual correct name of the text box in both instances.

            • #757204

              Hi Hans

              Sorry to be a pain could you show me how it should look, the name of the field is callback.

              Thanks

              Braddy

            • #757210

              Private Sub Callback_AfterUpdate()
              If Me.Callback = Date Then
              MsgBox “You entered the current date!”, vbInformation
              End If
              End Sub

            • #757212

              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

            • #757259

              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.

            • #757453

              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

            • #757455

              Can I suggest that you test for :

                Me.txtDateField >= Date  

              rather than

                Me.txtDateField = Date 

              in case you happen not to use the database on the day a contact is due.

            • #757460

              Hi John

              Thanks for the reply I look at it later

              Thanks

              Braddy

            • #757549

              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.

            • #757648

              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

            • #757693

              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.

            • #757969

              Hi Dave

              Thanks for the file I will probably settle for your suggestion, so a big thanks to all who replied to this request.

              Braddy

            • #757970

              Hi Dave

              Thanks for the file I will probably settle for your suggestion, so a big thanks to all who replied to this request.

              Braddy

            • #757694

              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.

            • #757649

              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

            • #757550

              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.

            • #757704

              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

            • #757705

              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

            • #757461

              Hi John

              Thanks for the reply I look at it later

              Thanks

              Braddy

            • #757456

              Can I suggest that you test for :

                Me.txtDateField >= Date  

              rather than

                Me.txtDateField = Date 

              in case you happen not to use the database on the day a contact is due.

            • #757454

              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

            • #757260

              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.

            • #757213

              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

            • #757211

              Private Sub Callback_AfterUpdate()
              If Me.Callback = Date Then
              MsgBox “You entered the current date!”, vbInformation
              End If
              End Sub

            • #757205

              Hi Hans

              Sorry to be a pain could you show me how it should look, the name of the field is callback.

              Thanks

              Braddy

            • #757203

              In the code in your screenshot, the name of the control in the Private Sub line and in the If … Then line don’t match. You must use the real actual correct name of the text box in both instances.

            • #757201

              Hi Hans

              I have corrected my silly mistake and now I get no error, but i also do not get the msgbox if i enter the date equal to todays date.

              Braddy

            • #757197

              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.

          • #757195

            Hi

            I am doing something wrong can you tell me what please.

            Braddy

        • #757193

          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?

      • #757187

        Hi Hans

        I mean the current date, It’s client database it is so I can use it as a call back reminder.

        Thanks

        Braddy

    • #757179

      Is datenow another field, or do you mean the current date by datenow? And what do you want to accomplish with the message box?

    Viewing 1 reply thread
    Reply To: MsgBox (Access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: