Open different startup form when using replica

davea300

Registered User.
Local time
Today, 21:03
Joined
Mar 16, 2007
Messages
164
I have a replicated database and I need to open a different startup form to that of the design master when the replica copy is opened. The replica is used on a samsung Q1 mobile PC so I have a different startup form that suits the res of the screen better.

You can't change the startup options in a replica so I thought I could write some code to perhaps get hold of the PC name and open a startup form depending on what it was? Has anyone captured PC info like this using vb?

The database doesn't have user permissions set up and I would like to avoid doing this if possible.

Any other suggestions?
 
There is a wonderful function available within VBA called Environ(). It will return to you the value of any variable within the computer's environment area. Within Access, press Ctrl G to display the Immediate window, then type (or copy) the following into the Immediate window and press enter for a list of all the variables you can retrieve.
Code:
for x=1 to 50:debug.Print environ(x): next x
The one I think you are looking for would be ComputerName. You also have available the UserName, which is the UserName from Windows.
The syntax to get ComputerName would be:
Code:
MyReturnVariable = Environ("ComputerName")
 
Perfect! exactly what I was looking for. I used Environ(ComputerName) on the Open Event of my startup form to check the PC name. If is is the mobile PC it opens the other version of the startup form.

Thanks very much!
 
First off, you really need to split your app because Jet replication does not work reliably in the long run with front-end objects -- it is reliable only with tables and queries. Once you do that, your problem completely vanishes, as your only DM will be for data tables.
 

Users who are viewing this thread

Back
Top Bottom