Senin, 23 Mei 2011

Re: [MS_AccessPros] Re: Running a showcase query from vba

 

aha! I've got it!

found it here: http://www.pptfaq.com/FAQ00479.htm

Option Compare Database
Option Explicit

Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As
String, ByVal nShowCmd As Long) As Long

Public Sub RunProgram(strProgram As String)
Dim lRet As Long ' Get the return value
' Execute the API call
lRet = ShellExecute(vbNull, "", strProgram, "", "", 0)
' If ShellExecute works it will return a number greate than 32
' Otherwise call our ReportError function to see what went wrong
If lRet <= 32 Then
MsgBox "Error Running Program"
End If
End Sub

Respectfully,
Liz Ravenwood
Programmer/Analyst
Super First Class Division
BE Aerospace, Inc.
(O): 1.520.239.4808
E-Mail: Liz_Ravenwood@beaerospace.com
www.beaerospace.com

<liz_ravenwood@beaerospace.com>
Sent by: <MS_Access_Professionals@yahoogroups.com>
05/23/2011 01:22 PM
Please respond to
<MS_Access_Professionals@yahoogroups.com>

To
<MS_Access_Professionals@yahoogroups.com>
cc

Subject
Re: [MS_AccessPros] Re: Running a showcase query from vba

Bill,

I was thinking about the space thing as well just recently so I used the
filename ODTest.DBQ and tried it with that. I still got the same error
message. It also apparently needs the respective dll in tools/references.

(Microsoft Shell ...) Google yielded info such as shell only working
with .exe files, so now I'm looking at an API function OpenFile. I just
opened a book to it, so I know nothing and still welcome suggestions and
knowledge.

Respectfully,
Liz Ravenwood
Programmer/Analyst
Super First Class Division
BE Aerospace, Inc.
(O): 1.520.239.4808
E-Mail: Liz_Ravenwood@beaerospace.com
www.beaerospace.com

Bill Mosca <wrmosca@comcast.net>
Sent by: <MS_Access_Professionals@yahoogroups.com>
05/23/2011 01:03 PM
Please respond to
<MS_Access_Professionals@yahoogroups.com>

To
<MS_Access_Professionals@yahoogroups.com>
cc

Subject
[MS_AccessPros] Re: Running a showcase query from vba

Well, not even knowing what the heck a showcase query is, all I can say is

that the Shell function doesn't like spaces in paths so you have to
surround the thing in double-quotes like this:
varODDone = Shell(Chr(34) & "DriveName:\path...\Open Demand based off SO #

rev A.dbq" & Chr(34))

But you might have to include the program's path as well. I'm not sure if
the extension is mapped to it or not. If you need to include the program
put it first and surround it with double-quotes as well with a space
between the 2 paths.

Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.support.microsoft.com/profile/Bill.Mosca

--- In MS_Access_Professionals@yahoogroups.com, <liz_ravenwood@...> wrote:
>
> Pros, does anyone know how to run a showcase query from VBA? This is my

> latest attempt:
>
> dim varODDone as variant
>
> varODDone = Shell("DriveName:\path...\Open Demand based off SO #
rev
> A.dbq")
>
> Respectfully,
> Liz Ravenwood
> Programmer/Analyst
> Super First Class Division
> BE Aerospace, Inc.
> (O): 1.520.239.4808
> E-Mail: Liz_Ravenwood@...
> www.beaerospace.com
>
>
>
>
>
----------------------------------------------------------

>
> This email (and all attachments) is for the sole use of the intended
> recipient(s) and may contain privileged and/or proprietary information.
> Any unauthorized review, use, disclosure or distribution is prohibited.
If
> you are not the intended recipient, please contact the sender by reply
> e-mail and destroy all copies of the original message.
>
> [Non-text portions of this message have been removed]
>

------------------------------------

Yahoo! Groups Links

----------------------------------------------------------

This email (and all attachments) is for the sole use of the intended
recipient(s) and may contain privileged and/or proprietary information.
Any unauthorized review, use, disclosure or distribution is prohibited. If

you are not the intended recipient, please contact the sender by reply
e-mail and destroy all copies of the original message.

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

----------------------------------------------------------

This email (and all attachments) is for the sole use of the intended
recipient(s) and may contain privileged and/or proprietary information.
Any unauthorized review, use, disclosure or distribution is prohibited. If
you are not the intended recipient, please contact the sender by reply
e-mail and destroy all copies of the original message.

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar