Fields Updating Message

MHamid

Active Member
Joined
Jan 31, 2013
Messages
472
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello,

I was wondering if it would be possible to have a message box pop up after an update to a record has been made stating what field or fields have been updated. I have update 20 fields that can be possibly updated, but not all will be updated. Instead of showing a generic "Record has been updated successfully", I would like the message box to say what field(s) was updated.
Is this possible? If so, how can I achieve this?


Thank you
 
That is what I would expect as you are overwriting the string each time.
I told you that in a previous post. :-(

Once again

Code:
strMsg = strMsg & "- " & ctl.ControlSource & vbCrLf
You will have a - at the start, but let's get it working first.
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
welshgasman,

I already have that string working. I've said that multiple times already. The message box will appear with only one field mentioned that it was updated instead of all fields that have been updated.

I don't understand where I'm confusing you :confused:
 
Upvote 0
Code:
If ctl.OldValue <> ctl.Value Then strMsg = "- " & ctl.ControlSource & vbCrLf

you need to append each field each time, so it should be:
Code:
If ctl.OldValue <> ctl.Value Then strMsg = [B][COLOR="#FF0000"]strMsg & [/COLOR][/B]" - " & ctl.ControlSource & vbCrLf
 
Upvote 0
I see it now, lol. So sorry. I've been working on very little sleep for a while now and the codes were looking the same to me.

Thanking for pointing out the difference, xenou.

My apologies welshgasman. This is what you've been saying. Sorry for the frustration I've caused.
 
Upvote 0
Sorry that I have't been able to keep up. I'm away on vacation. Thanks xenou for pitching in. Re
Please explain how I'm supposed to be going through the code step by step using F8.
Some keyboards behave differently than others. When you were told to do that, the expectation would be that your cursor would be positioned in the code on an executable line (the very first would be best), and by pressing F8, the procedure would begin to execute, but only one line at a time for each F8 keypress. Given that the problem may be the lack of concatenation as pointed out by xenou, that may not have proved anything, but at least we would have been able to move off of the suggestion. As for the object or with block variable error message, it is one of those 'not very helpful messages' that you'll get. When it involves an object problem, it an be because an error has caused the object property, or the object itself, to cease to be available. Most often I find it results from your code trying to make use of an object that hasn't been declared, which indicates that the code writer may not have Object Explicit at the top of the modules.

Be that as it may, the idea of stepping through code, by whatever means, is a powerful method of exposing errors. If you can't see the value of a variable, or if an object actually exists, by mousing over the relevant piece of code, you can at least check it in the immediate window while the code is suspended.
 
Upvote 0
I see it now, lol. So sorry. I've been working on very little sleep for a while now and the codes were looking the same to me.

Thanking for pointing out the difference, xenou.

My apologies welshgasman. This is what you've been saying. Sorry for the frustration I've caused.

No worries, at least you have now got the message. :D
I believe you need to study on how to debug VBA code. That will help you tremendously on errors like these.
It's a godsend for my errors. :D
 
Upvote 0
Thank you, xenou. That was going to be my next question :)
 
Upvote 0

Forum statistics

Threads
1,223,981
Messages
6,175,775
Members
452,668
Latest member
mrider123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top