Open Form

  • Thread starter Thread starter DS
  • Start date Start date
You mean you want to be sitting at computer A and do something that opens a
form on computer B?

There's nothing built into Access to provide that capability. I suppose you
could have a shared table where you indicated the name of the form to open
and the computer on which to open that form, and have a timer that checks
that table on a regular basis.
 
Thanks Doug,
Thats right. I want to Open a Form on another computer that is on the
network. They all have the same front ends and are connected to the same
backend.
How would I execute your suggestion?
DS
 
As I said, create a table that accepts the name of the form and the name of
the computer. (If you want to use the actual computer name, see
http://www.mvps.org/access/api/api0009.htm at "The Access Web" for code to
retrieve it)

Have a form that's always open, and use its TimerInterval to set how
frequently you want to check whether there's a form that needs to be opened.
(The TimerInterval property is in milliseconds, so setting Me.TimerInterval
= 30000 means that the Timer event would fire every 30 seconds).

The code in the form's Timer event would be something like:

Private Sub Form_Timer()
Dim dbCurr As DAO.Database
Dim rsCurr As DAO.Recordset
Dim strMachineName As String
Dim strSQL As String

strMachineName = fOSMachineName()
strSQL = "SELECT FormName " & _
"FROM MyTable " & _
"WHERE MachineName = '" & strMachineName & "'"

Set dbCurr = CurrentDb()
Set rsCurr = dbCurr.OpenRecordset(strSQL)
Do Until rsCurr.EOF
DoCmd.OpenForm rsCurr!FormName
rsCurr.MoveNext
Loop
rsCurr.Close
Set rsCurr = Nothing

strSQL = "DELETE FROM MyTable " & _
"WHERE MachineName = '" & strMachineName & "'"
dbCurr.Execute strSQL, dbFailOnError
Set dbCurr = Nothing

End Sub
 
Back
Top