VBA Code (New to VBA)

Duman

New member
Local time
Today, 15:41
Joined
Nov 27, 2002
Messages
6
I'm new to programming, please help if you can. Working on a database using Access 2k. Have a form made from a table, and in this form I have a field that will either be a number 1 or 0. I want to have a pop up message when the number in that field changes. How do I do that? Thanks for your help.
 
Use the AfterUpdate event of that field to display your message box. My example below shows the code for the AfterUpdate event for my text box named "TextBox1".

Private Sub TextBox1_AfterUpdate()
Beep
MsgBox "The value in the x field has been modified.", vbInformation, "X Field Modification"
End Sub

Also, you might want to ensure the users only key a 1 or a 2 in that field by using a Validation Rule. Try this...
Validation Rule: =1 Or 2
Validation Text: The x field will only except a 1 or a 2.

HTH
 
Let me explain a little better. I’m a network engineer. I have a network monitoring program that monitors my network routers and switches, it’s called SolarWinds. This program keeps information about all the interfaces that I monitor. They save all this info in a database with a .cfg extension which you can open with Access. I have a database that has info about the routers and switches as well. I have linked tables from the SolarWinds database in my database. One of these linked tables has info about the interfaces that I’m monitoring, it poles these interfaces every 180 sec. it will tell me if that interface is up or down. There is a field in this table that changes from a 1 (up) to a 0 (down).
What I want to do is either have a popup saying that an interface has gone down or has come back up. Better yet have a field on a form built from that table change color. Is this possible or am I reaching too far.
Thanks for your help.
 
I might be wrong but I think that if you have a form open showing data from a link file then the file is locked and cannot be updated by another source. So far that seems to be the case having tested it on Excel and also on dbf created by Monarch (not MS product). You will need to test this before you go any further in your quest!

If that does prove to be the case then think that you will need to create code that runs every 180 seconds and does the following:

copies the temp table to temp2 by using a make table query
copies the link table into a temp table by using a make table query.
compares the temptable to temp2table to see what has changed using a query
show the query. It ought to be empty unless something has changed.
OR
feed a form from the temp table but this will not be able to show changes unless you show the results of both tables and compare within the form (different from showing just changes as this will show all records including those that have not changed)

HTH
 

Users who are viewing this thread

Back
Top Bottom