473,395 Members | 1,742 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.

Initiate VBA code remotely on different access users

157 100+
Hello!

Is there a way to do this?

Like i am sitting at Computer2 and want code on Computer1 to initate.

Purpose could be to run docmd.quit or docmd.openform "New message" and things like that
Mar 25 '09 #1
7 1516
Stewart Ross
2,545 Expert Mod 2GB
Not possible as far as I know - and even if such an approach from one PC to another was possible it could be blocked by firewall software or anti-virus software as a potential attack on the system...

-Stewart
Mar 25 '09 #2
MrDeej
157 100+
One solution is (i use this today)

Computer1 has a form going in the background which chekcs field1 on table1 every 1000ms or so.

Computer2 makes a edit to field1 on table1.

Computer1 has

Expand|Select|Wrap|Line Numbers
  1. Private sub form_timer()
  2. dim rst as new adodb.recordset 
  3. with rst
  4.      .open "SELECT * from [table1]",currentproject.connection, adopenforwardonly, adlockreadonly
  5.  
  6.        If !field1 = "somevalue" then
  7.             'do something useful
  8.        end if
  9.        .close 
  10. end with
  11. set rst = nothing
  12.  
  13. end sub
in its timer

But this makes the form hang some milliseconds every cycle and i think this is somewhat n00b programming :=)

I use this to display a message popup to all users, but all users gets the message at different times and i think that is unproffecionale programming.
I also use this to initiate a 'Docmd.quit' at the users which has forgotten to log of.

But i really want to find a better way to intiate code. Hope someone here has some tips :=)
Mar 25 '09 #3
ChipR
1,287 Expert 1GB
I use code very similar to MrDeej. I have a table called LogMeOff, which I can add user names to from a form. Since the frontend has a form that stays hidden to keep the connection open, I put the timer in that form. userName is a global variable set to the windows logon name when the user opens the app.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2. On Error GoTo ErrorHandler
  3.     If DCount ("UserName", "LogMeOff", "UserName = """ & userName & """") > 0 Then
  4.         DoCmd.OpenForm "Auto Log Off"
  5.     End If
  6. ExitCode:
  7.     Exit Sub
  8. ErrorHandler:
  9.     HandleError Err.number, Err.Description, Me.Name & ":Form_Timer"
  10.     Resume ExitCode
  11. End Sub
If you use a method like this, don't forget to remove the user from the table once you display the message or log them off or whatever.
Mar 25 '09 #4
MrDeej
157 100+
Nice. But since we both have found this to be a solution to remote executin code, then i am starting to think that it is no other way.

We should have had a afterupde event which is triggered by the change in a table rather than a code to check values every xxx ms...
Mar 25 '09 #5
ChipR
1,287 Expert 1GB
That seems like a good idea. I guess you'd have a hidden form bound to any table that you wanted to watch for messages.
Also, my timer is set to 1 minute since logging people off isn't really urgent.
Mar 25 '09 #6
MrDeej
157 100+
@ChipR

But it isnt possible to trigger a VB code to run unnles you use a Form_Timer event or the user interacts. As i can see this is the only way

I use 10 seconds or so because i use this to bring messages to all employes at the same time. They almost get the message at the same time, and when the message opens i have a sound played which you can hear troughout the factory ... Sometimes i get a bit of a laugh of this because it is monty Python "Message for you sir" hehe
Mar 25 '09 #7
ChipR
1,287 Expert 1GB
You're right, I don't see any event that works. That data change event sounded promising until I found it only applied to pivot tables. And Access can manage triggers for tables in a SQL Server backend, but not it's own.
I wonder if any experts can share their experience, whether they have used a method like this or would steer clear.
Mar 25 '09 #8

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

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
23
by: Han | last post by:
Our app runs on end-users machines (apache2.x + php5). At this moment it is quite easy for someone (who has access to the console) to insert a couple lines of php code to steal sensitive info. ...
0
by: Terry Olsen | last post by:
Is there a way to remotely add/change/delete Local User/Group accounts remotely from VB.Net? We have a utility that would allow us to add a username to a local "netop" group on a PC. This then...
2
by: esqueletoh | last post by:
Hi, i'm having a very weird problem. I have an application Asp .Net (Framework 1.1) that uses form authentication. To deny access to non-authenticated users i use <authorization> <deny users="?"...
3
by: Greg Strong | last post by:
Hello All, Is there any way to close an ODBC connection via DSN without completely closing the Access front-end? I'm doing some testing with using Access as a front-end to Oracle 10g Express...
0
by: Bazza Formez | last post by:
Hi, Can anyone suggest a technical solution to this tricky business requirement.... I am developing an online ordering system using ASP.NET. (Orders are entered online from the web by...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
36
by: The Frog | last post by:
Hi Everyone, I am trying to find a solution for handling zipped data without the need to ship / install any DLL files with the database. Does anybody know of code to handle ZIP files that does...
6
by: Jonathan Wood | last post by:
The ASP.NET Configuration tool is great for quickly managing users in the database on my development machine. However, I don't see a way to use it to access the database on my Web server. 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:
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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
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,...

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.