Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function Question

Status
Not open for further replies.

Monguse

Programmer
Mar 11, 2002
63
US
Below is the code I am working on - I want to return the value from the Function so thaat I know if the program is already running, however it has been a long time sence I've used a Function and cannot remember how to get it to pass the responce back.
Will one of you point out my error please - Thanks!

Sub Main()
Program_Is_Already_Running (Run)

If Run = False Then
frmSplash.Show
frmSplash.Refresh
OpenData
Set fMainForm = New frmMain
Load fMainForm
Unload frmSplash
fMainForm.Show

Elseif Run = "True" then
response = msgbox("Program Already Running", vbOKOnly, "Startup Error")
End
End If
End Sub


Function Program_Is_Already_Running(R1 As String)

R1 = App.PrevInstance

End Function
"The beauty of the second amendment is, that it will not be needed until they try to take it." - Thomas Jefferson

WebMaster:
 
if App.Previnstance then
Program_Is_Already_Running = True
else
Program_Is_Already_Running = False
End IF
Good Luck
------------
Select * from Users where Clue > 0
0 rows returned
 
Program_Is_Already_Running = App.Previnstance is shorter

It has been a long time hasn't, you are all back to front. Look at this.

Sub Main()


If Not Program_Is_Already_Running () Then
frmSplash.Show
frmSplash.Refresh
OpenData
Set fMainForm = New frmMain
Load fMainForm
Unload frmSplash
fMainForm.Show

Else
response = msgbox("Program Already Running", vbOKOnly, "Startup Error")
End
End If
End Sub


Function Program_Is_Already_Running() AS Long

Program_Is_Already_Running = App.PrevInstance

End Function

Does that make sense? Peter Meachem
peter@accuflight.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top