473,395 Members | 1,466 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,395 software developers and data experts.

Message box to alert if changes are being made on a form/subform

52
Hi,

I have successfully added code that alerts the user if they are making a change to a record when a check box is 'true'. However, the form includes a subform. I can't work out how to trigger the message box when changes are made on the subform.

I don't know how to include the subform in my code below.
OR whether to write code for the subform and reference the check box (I tried frm.DischargedSP and Me.frm.DischargedSP

The subform is called: sbfrmContacts
The check box is called DischargedSP and the main form is called frmClientForm.

My code is as follows (the yes/no message box works):

Private Sub Form_Dirty(Cancel As Integer)
If DischargedSP = True Then
Response = MsgBox("You are editing a client whose episode of care is closed. Do you want to proceed?", vbYesNo)
If Response - vbYes Then
Cancel = True
Me.Undo
End If
End If
End Sub


Really appreciate some help.

thanks,
Marcella
Oct 20 '16 #1

✓ answered by PhilOfWalton

I suspect you could use exactly the same code on the subform, but change the second line to:-

Expand|Select|Wrap|Line Numbers
  1.     If Me.Parent!DischargedSP = True Then
  2.  
Phil

4 842
jimatqsi
1,271 Expert 1GB
I think this is what you need. I keep a bookmark to this page and find myself visiting it often.
http://access.mvps.org/access/forms/frm0031.htm

Jim
Oct 22 '16 #2
PhilOfWalton
1,430 Expert 1GB
I suspect you could use exactly the same code on the subform, but change the second line to:-

Expand|Select|Wrap|Line Numbers
  1.     If Me.Parent!DischargedSP = True Then
  2.  
Phil
Oct 22 '16 #3
mjvm
52
thank you for this.
ticked this as best reply because it answered my question in the most straightforward way - which is what I need :)
Oct 27 '16 #4
mjvm
52
thanks Jim - this is a really useful page, and I'm sure others will find it helpful.
Oct 27 '16 #5

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

Similar topics

4
by: Don Seckler | last post by:
I am building an application to track the distribution and returns of copies of magazines. Copies of a magazine that are unsold are returned by the retailer to the wholesaler. They are...
0
by: Bob | last post by:
Hi Everybody I've spent a few hours pondering this one. I have a form frmInvoice (InvoiceID) and a subform zfrmInvoice (InvoiceID) I am able to print a passable report that...
2
by: jcridgeway | last post by:
I cannot get my parent form to reflect the changes in the child subform. To illustrate, use the Northwind database and type the following code in the OnCurrent event of the Orders form. If .! >...
3
by: Simone | last post by:
Hi All, I have a Find Record button setup in most of my forms in order to find a specific customer's details. I have just noticed today though that this search will only find the customer if it...
5
by: ego | last post by:
Hi all , I had created the following Form/SubForm structure : MainForm SubForm A (SubForm of MainForm) SubForm B (SubForm of SubForm A) SubForm C (SubForm of SubForm B) SubForm D ...
9
by: PC Datasheet | last post by:
I'm stuck on something that seems should be easy and I need some help. My main form has an option group with five options. My subform chooses from different lists depending on which option is...
10
by: Thelma Lubkin | last post by:
My form/subform combination that allows user to display 'ColorSet' records, move to other records via a selector, to add,delete, and edit them, and to manage the related 'Color' records from the...
5
by: Ron | last post by:
Hi All, I've got a form called frmCust that has a subform on it called sfrmBalance. sfrmBalance's control source is a query called qryTrans4CustBal. sfrmBalance has one field on it called...
2
by: ncsthbell | last post by:
I made some minor code changes to a form (not the main form), closed the app and when I try to open it, my main form will not open, I have a blank screen. I also tried going back into the form I...
1
by: troy_lee | last post by:
I have a table (Table A). It has one field, a PK. It is in a 1:M with another table (Table B). I am having trouble with a form/subform setup to view the 1:M records. On the parent form, there is...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.