473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Can some one provide me VBA codes to make the warning dialog box popout?

Hi,
Does anyone know how to insert a warning message (make a warning message dialog box displays also) so the user can be aware when he/she selects “CLOSED” from the Status combo box that the form will not be editable once the current is saved/close or if there is a new record is added? (I would like to have a YES and NO button on the dialog box also.)

The warning message should be like this:

This form will not be editable after you save, close or add a new record. Do you want to continue?



Thank you for your help!

Below are the VBA codes I have used. If you have any other codes better than mine, please feel free to let me know. Thanks


Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_AfterUpdate()
  2. If Me![STATUS] = "CLOSED" Then
  3.     Me.AllowEdits = False
  4.     Else
  5.     Me.AllowEdits = True
  6. End If
  7.  
  8. End Sub
  9.  
  10.  
  11.  
  12. Private Sub Form_Current()
  13. If Me![STATUS] = "CLOSED" Then
  14.     Me.AllowEdits = False
  15.     Else
  16.     Me.AllowEdits = True
  17. End If
  18.  
  19. End Sub
Apr 29 '14 #1
4 1327
jimatqsi
1,271 Expert 1GB
ab,
What you want is the MsgBox function. Take a look at it. You'll call it something like this:
Expand|Select|Wrap|Line Numbers
  1. if msgbox ("Hey there user, did you know that ...",vbYesNo)=vbYes then ... do stuff
  2. else
  3.    don't do stuff
  4. end if
Apr 29 '14 #2
zmbd
5,501 Expert Mod 4TB
here's the link:
MsgBox Function (ACC2007 but it hasn't changed since ACC2003)
Apr 29 '14 #3
Hi zmbd and jimatqsi,
I know that I need to have VBA code for this but I am absolutely don't know anything about how to write it and where to insert it. Could you please kindly provide me a VBA code and show me where to insert it?
Thanks
Apr 29 '14 #4
zmbd
5,501 Expert Mod 4TB
What I can and will do is PM you a basic set of tutorials and reference links. Please check your Bytes.com Inbox.

You absolutely must master the first tutorial in this set before you can hope to get anything useful out of Access and benifit from the help we can give you here, or indeed, in any Access website.
Apr 30 '14 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Steve | last post by:
I'm working in PHP, but am also using JavaScript, so perhaps there is a better way to do this using more PHP code...... I setup a search screen for my database, the user enters data and submits...
37
by: ajay | last post by:
How to make a web page getting refreshed after a given time interval automatically. HTML Code plz. Tx Ajay
2
by: cyshao | last post by:
When we copy files in MyComputer, there is a dialog with a ProcessBar and a Cancel button. Does C# provide something like this dialog? Thanks CYShao
0
by: MelaOS | last post by:
I'm builiding a MFC app wizard dialog based console application..phew... and i was wondering how do i put my own written class codes inside this dialog program? 1. Can i make it so with a push of...
5
by: John | last post by:
Hi When I press the delete button on the BindingNavigator it deletes the record without any warning. How can I add a warning dialog when the delete button on the BindingNavigator is pressed and...
2
by: HONOREDANCESTOR | last post by:
I have code like this TheDialog.ShowDialog If the user fills in the fields, and then hits OK, and then later comes back to the dialog to add a different item, the dialog is still filled with the...
4
by: forest demon | last post by:
i've seen previous posts somewhat related to this, so i apologize if this is redundant. I have a main form with separate threads. When showing a dialog like <dialog>.ShowDialog(), it functions...
11
by: Zytan | last post by:
I have created a new form from the main form. When I close the main form with the 'x' close button, its Form.FormClosed event is run, but not the dialog's. Is this normal? It is ok /...
9
yosiro
by: yosiro | last post by:
In the table i have 2 field: Name and Status I create a form datasheet view for data input How to create warning if i type duplicate data on that form?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.