473,407 Members | 2,629 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,407 software developers and data experts.

Issuing an alert when a control value is changed...this is driving me nuts...

Hi all,

I have a DB which is designed to have 1 admin and several users on at the same time. The users and admin all work with the same form, called frmOrders, which is a continuous form that lists out, in real time, orders which the users enter. I have a timer form called frmTimer running (hidden) in the background which updates frmOrders every 2 seconds and checks if a new order has been added. If yes, a MsgBox pops up on the admin's screen saying that a new order has been entered.

I'm trying to add some functionality so that any time a user changes the value in any field for an order that he/she has *already* entered, a MsgBox pops up on the admin's screen as well. However, I'm having some trouble with this. Basically, I want Access to 1) recognize when a field in an order is updated/changed, 2) check if the CurrentUser is the admin, and 3) if yes, give him a popup MsgBox alerting him that the particular field in question has been changed. Below is an example of the code I'm using right now for the Order Quantity field, but it doesn't work - the admin doesn't get a popup when the field is changed. Nothing happens.

Expand|Select|Wrap|Line Numbers
  1. Private Sub OrderedLots_AfterUpdate()
  2.   If CurrentUser() = "Admin" Then _
  3.     MsgBox "The order quantity for order ID " & [IDKey] & _
  4.            " has been changed. Please check the Order Status screen", _
  5.            vbExclamation, _
  6.            "Change made to order quantity."
  7.   End If
  8. End Sub
I was wondering if anyone could shed some light on this or provide an idea on how I can get done what I need to get done? This is starting to drive me bonkers...Thanks!
Jan 22 '09 #1
4 1668
ChipR
1,287 Expert 1GB
Your users will all have a different copy of that form in memory. When a non-admin updates a field, that code is called on their form, and nothing happens. When an Admin updates that field, however, they should get a message saying that they updated it.
I have an issue that is similar, but not quite the same, so there may be an easier way for you to do this. I have a table in my DB that as an admin I can add a user to. Every 30 seconds, a hidden form in every user's copy of the frontend checks that table to see if their username is in it, and if it is, quits out of access. So for your problem, any time a user made a change you could insert into the table, and when your admin checked the table, it could give notice if the recordcount > 1. It should also delete the records once it recognizes them. Records could be a single field with yes/no or whatever.
Jan 22 '09 #2
Hey ChipR,

Thanks for the response.

So just to get this straight:
1. Every time a user makes a change to one of their orders (I assume I'll use the control's AfterUpdate event), the value is inserted into the "holder" table.
2. The hidden timer form will check every X seconds to see if there is something in the holder table. If yes, issue a MsgBox where CurrentUser = Admin.
3. Delete the entry in the "holder" table.

That sounds good, the only question I have is how will the table be able to handle different field types? If the "holder" table is set up so that it has a text field and a number field, what happens if a user changes a Yes/No control on the form? How will tht be inserted into the "holder" table? Or does this not matter (maybe if I use SQL to do the insert, this issue is irrelevant)?
Jan 22 '09 #3
ChipR
1,287 Expert 1GB
Yes, I would use an SQL insert, and you can put whatever you want in the table, just the fact that a record is there will alert your admin that something was changed. If you want to give a more specific message to the admin, and you have AfterUpdate events on each of your controls, you could insert the field name, and you may very well want to insert the record number, because when you tell them that something in the recordset changed, then you could tell them which record and which field it was with a DLookup on your table.
For efficiency, I would test for admin first, and if admin, then check the table.
Also, decide whether you want to process each record in the holder table individually, or just say "1 or more changes have been made to the current recordset" and delete them all.
Jan 23 '09 #4
NeoPa
32,556 Expert Mod 16PB
What code do you currently use to determine whether or not a user has added a record, so that the Admin can see this?
Jan 23 '09 #5

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

Similar topics

22
by: Richard | last post by:
I've really tried searching for this before I thought of bother you guys with this question. It's such a simple thing, but it's driving me nuts! Is it possible to check if an int (or any other...
3
by: BBFrost | last post by:
Ok, I know how to count the number of selected datagrid rows using the code below. What has me stumped is how to determine when the selected rows within a datagrid have been changed. The...
1
by: TN Bella | last post by:
Hello, I was looking through the older posts for a solution to this problem, but I am still confused on how to fix my problem. There are two dates on my form, one (txtInvDate) is entered by the...
1
by: Simon | last post by:
Hi everyone, I have a quick question that I hope someone can help me with: I've made a user control that contains a text box and some validation functionality. This control has a few extra...
7
by: Tom wilson | last post by:
I'm trying to create dynamic controls in ASP.Net. It's driving me nuts. I keep getting the error: Control '16' of type 'RadioButton' must be placed inside a form tag with runat=server. Dim...
0
by: robgallen | last post by:
I have 2 user controls within a master page, and I would like one of them to call a function in the other. All the examples I have seen involve a page communicating with the Master page, or with...
4
by: clentoc | last post by:
I'm pretty new to javascript so this may well be a really basic error, but I've spent hours trying to fix it with no joy. I have written some code which looks in a CSV file, filters it depending...
2
by: Jonathan N. Little | last post by:
As part of a JavaScript precheck form validation I noticed a problem with trying to return focus to the field with an error. I have setup a demo page. ...
1
by: avipeter | last post by:
Hi to all. I am so new in this, I don't know how to finish my homework-question. I have to go to bed now ánd need to find an answer a.s.a.p. Who is willing to help this Dutch boy? I have to...
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: 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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.