Message box if we never change the textbox value...

anbusds

Registered User.
Local time
Today, 05:35
Joined
Mar 25, 2015
Messages
35
Dear all,
I would like to display message box in access VBA if the user forget to change the text box value after clicking the submit button...
Example:
1 card contains 9 rows when they input the 7th row message box should come out "please remember to Change the card Number"

Thanks in advance!!! :)
 
After the "submit" action and subsequent code is complete, set the textbox to Null.
 
Hi,
Card number contains 10 characters so every time need to key in wasting of time that's why i don't want to make it null after click the submit button...
just to remind them to change after every 7 times click the submit button...
Thanks for your reply!!!
 
At the Submit_Click event procedure, you can add

Code:
     If Nz(Me!CardNumber) = "" Then
        MsgBox = "Please enter the Card Number."
        Me!CardNumber.SetFocus
        Exit Sub
     End If

     ...

What this code does is
1. Check if CardNumber field is empty or not.
2. If empty, show a warning and
3. Move the cursor to CardNumber field.
4. Get out of Submit procedure.
5. If CardNumber is not empty, Submit procedure continues.
 
Hi Shoji,
Understood the code works well, but my intention is to prompt message to remind them to change the card number after 7 times i pressed add button...
Thanks For your reply...
Any solution Experts?
 
You talk about "rows". I am not sure how your form looks like, but you can pop up a warning when the user finishes the 7th "row" by AfterUpdate event.

Create an AfterUpdate event for the 7th field (row) like
Code:
Private Sub Field7_AfterUpdate()
    MsgBox "Please ...."
End Sub
 
Increment a counter in the click event of the Add button. If and when it gets to 7 display the message. You will need to know where to reset it back to zero for the next occurrence.

To go further, take a copy of the card number when you reset the counter to zero. When it gets to 7, check this saved value against the current card number. If the same, show the message, otherwise continue as normal.

HTH
 

Users who are viewing this thread

Back
Top Bottom