A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

passing values to a function



 
 
Thread Tools Display Modes
  #1  
Old December 8th, 2008, 05:30 PM posted to microsoft.public.access.gettingstarted
Bre-x[_2_]
external usenet poster
 
Posts: 30
Default passing values to a function

Hi, I have this function :

Public Function open_app()
Call Shell("msaccess.exe ""M:\INV\Inv_JEFF.mdb""", 1)
DoCmd.Quit
End Function

I would like to pass a value ( the path of the mdb)

Something like:

Public Function open_app(the_path as String)

Call Shell("msaccess.exe" the_path,1)

Thank you all

Bre-x


  #2  
Old December 8th, 2008, 06:04 PM posted to microsoft.public.access.gettingstarted
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default passing values to a function

Public Function open_app(the_path as String)

Call Shell("msaccess.exe """ & the_path & """",1)

End Function

That's three double quotes after msaccess.exe, and four double quotes after
the_path.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Bre-x" wrote in message
...
Hi, I have this function :

Public Function open_app()
Call Shell("msaccess.exe ""M:\INV\Inv_JEFF.mdb""", 1)
DoCmd.Quit
End Function

I would like to pass a value ( the path of the mdb)

Something like:

Public Function open_app(the_path as String)

Call Shell("msaccess.exe" the_path,1)

Thank you all

Bre-x



  #3  
Old December 8th, 2008, 06:24 PM posted to microsoft.public.access.gettingstarted
Bre-x[_2_]
external usenet poster
 
Posts: 30
Default passing values to a function

Thank you, it works!!


Public Function open_app(theapp As String, thepath As String)
On Error GoTo Err_open_app
Dim ie As Object

Select Case theapp
Case "MSACCESS"
Call Shell("msaccess.exe """ & thepath & """", 1)
DoCmd.Quit
Case "MSEXCEL"
Call Shell("excel.exe """ & thepath & """", 1)
DoCmd.Quit
Case "MSWORD"
Call Shell("word.exe """ & thepath & """", 1)
DoCmd.Quit
Case "IE"
Set ie = CreateObject("InternetExplorer.Application")
ie.AddressBar = False
ie.MenuBar = True
ie.Toolbar = True
ie.Width = 1024
ie.Height = 768
ie.Left = 0
ie.Top = 0
ie.navigate thepath
ie.resizable = True
ie.Visible = True
Set ie = Nothing
DoCmd.Quit
Case Else
Responce = MsgBox("Application Error.", vbCritical, " UMCORP")
Exit Function
End Select
Exit_open_app:
Exit Function
Err_open_app:
MsgBox Err.Description
Resume Exit_open_app
End Function


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:16 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.