views:

38

answers:

2

In VBA (Access 2000) is there anyway to send information to a form between two open instances of the database?

For example :

User 1 has an instance open of DB.MDB on his PC and has FormOne open. User 2 has another instance of DB.MDB open on her PC and has FormOne open.

Can User 1 maniuplate the contents of a textbox on User 2's FormOne instance (ie. sending a message similar to a chat client)?

+4  A: 

You could store data to a table and update the form or subform on a timer.

Remou
This solution had come to mind but I was wondering if there was another way that didn't involve constant querying of a table.
patrick
A: 

Like Remou, I think the table method is as you are going to get. You can optimize the querying by maintaining a one-record table that has the value of the last update. Then have your timer form check to see if the value has changed since the the timer last triggered, this will tell the timer to check the chat table.

In the alternative you can have records deleted as soon as they are read to keep the table small.

You will find that all the record creation/deletion will bloat your database though, so be sure to compact it regularly.

Lastly if all users have access to a shared drive you could just store the messages in a text file instead of a table.

Another issue is of course eavesdropping (with tables or files). You could minimize this by: Obfuscating/encrypting the text before it is written and deobfuscating it when it is read. Deleting the record as soon as it is read by it's target. Hiding the file/table. For files use: SetAttr myFile, vbSystem or vbHidden For Tables prefix the table name with USys_ and make the table hidden.

All that said, it's still going to be a sorry substitute for a chat client. It will slow down the database and possibly slow down the shared drive. I would think long and hard about why I need this, and if it's really the best approach.

Oorang