PC Review


Reply
Thread Tools Rate Thread

What's wrong with this codes?

 
 
=?Utf-8?B?SnVsaSBJbnRlcm4=?=
Guest
Posts: n/a
 
      2nd Aug 2007
Why can't i run application from VB or from Command button? None of these
attempts are working:

Private Sub Command5_Click()
On Error GoTo Err_Command5_Click

Dim stAppName As String

stAppName = "I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"
Call Shell(stAppName, 1)

Exit_Command5_Click:
Exit Sub

Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click

End Sub


or another one:
Private Sub runCA_Click()

Dim FilePath As String

FilePath = "I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"
Application.FollowHyperlink FilePath


End Sub

Please, can somebody help? Thank you.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGFvbG8=?=
Guest
Posts: n/a
 
      2nd Aug 2007
Hi Juli,
actually the shell command run an executable program and an mdb isn't.
If you want to run an mdb with the shell command you must provide the path
of msaccess.exe followed by the mdb you wanna open.
assuming msaccess resides in C:\Program Files\Microsoft Office\Office

e.g. stAppName = "C:\Program Files\Microsoft Office\Office\msaccess.exe
I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"
Call Shell(stAppName, 1)

HTH Paolo

"Juli Intern" wrote:

> Why can't i run application from VB or from Command button? None of these
> attempts are working:
>
> Private Sub Command5_Click()
> On Error GoTo Err_Command5_Click
>
> Dim stAppName As String
>
> stAppName = "I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"
> Call Shell(stAppName, 1)
>
> Exit_Command5_Click:
> Exit Sub
>
> Err_Command5_Click:
> MsgBox Err.Description
> Resume Exit_Command5_Click
>
> End Sub
>
>
> or another one:
> Private Sub runCA_Click()
>
> Dim FilePath As String
>
> FilePath = "I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"
> Application.FollowHyperlink FilePath
>
>
> End Sub
>
> Please, can somebody help? Thank you.
>

 
Reply With Quote
 
=?Utf-8?B?SnVsaSBJbnRlcm4=?=
Guest
Posts: n/a
 
      2nd Aug 2007
I tried it, but no success. I don't what I'm doing wrong but it still gives
me an error: User-defined type not defined. Is there anything else i can try?
Thank you.

"Paolo" wrote:

> Hi Juli,
> actually the shell command run an executable program and an mdb isn't.
> If you want to run an mdb with the shell command you must provide the path
> of msaccess.exe followed by the mdb you wanna open.
> assuming msaccess resides in C:\Program Files\Microsoft Office\Office
>
> e.g. stAppName = "C:\Program Files\Microsoft Office\Office\msaccess.exe
> I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"
> Call Shell(stAppName, 1)
>
> HTH Paolo
>
> "Juli Intern" wrote:
>
> > Why can't i run application from VB or from Command button? None of these
> > attempts are working:
> >
> > Private Sub Command5_Click()
> > On Error GoTo Err_Command5_Click
> >
> > Dim stAppName As String
> >
> > stAppName = "I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"
> > Call Shell(stAppName, 1)
> >
> > Exit_Command5_Click:
> > Exit Sub
> >
> > Err_Command5_Click:
> > MsgBox Err.Description
> > Resume Exit_Command5_Click
> >
> > End Sub
> >
> >
> > or another one:
> > Private Sub runCA_Click()
> >
> > Dim FilePath As String
> >
> > FilePath = "I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"
> > Application.FollowHyperlink FilePath
> >
> >
> > End Sub
> >
> > Please, can somebody help? Thank you.
> >

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      2nd Aug 2007
Actually, because of the embedded spaces in the paths, you need quotes
around at least the path to msaccess.exe:

stAppName = """C:\Program Files\Microsoft Office\Office\msaccess.exe""" & _
" ""I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"""
Call Shell(stAppName, 1)

(The extra quotes around the path to the mdb file aren't strictly necessary,
but there's nothing wrong with including them.)

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


"Paolo" <(E-Mail Removed)> wrote in message
news:5456E1DD-F474-43FE-9DC6-(E-Mail Removed)...
> Hi Juli,
> actually the shell command run an executable program and an mdb isn't.
> If you want to run an mdb with the shell command you must provide the path
> of msaccess.exe followed by the mdb you wanna open.
> assuming msaccess resides in C:\Program Files\Microsoft Office\Office
>
> e.g. stAppName = "C:\Program Files\Microsoft Office\Office\msaccess.exe
> I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"
> Call Shell(stAppName, 1)
>
> HTH Paolo
>
> "Juli Intern" wrote:
>
>> Why can't i run application from VB or from Command button? None of these
>> attempts are working:
>>
>> Private Sub Command5_Click()
>> On Error GoTo Err_Command5_Click
>>
>> Dim stAppName As String
>>
>> stAppName = "I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"
>> Call Shell(stAppName, 1)
>>
>> Exit_Command5_Click:
>> Exit Sub
>>
>> Err_Command5_Click:
>> MsgBox Err.Description
>> Resume Exit_Command5_Click
>>
>> End Sub
>>
>>
>> or another one:
>> Private Sub runCA_Click()
>>
>> Dim FilePath As String
>>
>> FilePath = "I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"
>> Application.FollowHyperlink FilePath
>>
>>
>> End Sub
>>
>> Please, can somebody help? Thank you.
>>



 
Reply With Quote
 
=?Utf-8?B?SnVsaSBJbnRlcm4=?=
Guest
Posts: n/a
 
      2nd Aug 2007
Alleluia!! It works, thank you.

"Douglas J. Steele" wrote:

> Actually, because of the embedded spaces in the paths, you need quotes
> around at least the path to msaccess.exe:
>
> stAppName = """C:\Program Files\Microsoft Office\Office\msaccess.exe""" & _
> " ""I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"""
> Call Shell(stAppName, 1)
>
> (The extra quotes around the path to the mdb file aren't strictly necessary,
> but there's nothing wrong with including them.)
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Paolo" <(E-Mail Removed)> wrote in message
> news:5456E1DD-F474-43FE-9DC6-(E-Mail Removed)...
> > Hi Juli,
> > actually the shell command run an executable program and an mdb isn't.
> > If you want to run an mdb with the shell command you must provide the path
> > of msaccess.exe followed by the mdb you wanna open.
> > assuming msaccess resides in C:\Program Files\Microsoft Office\Office
> >
> > e.g. stAppName = "C:\Program Files\Microsoft Office\Office\msaccess.exe
> > I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"
> > Call Shell(stAppName, 1)
> >
> > HTH Paolo
> >
> > "Juli Intern" wrote:
> >
> >> Why can't i run application from VB or from Command button? None of these
> >> attempts are working:
> >>
> >> Private Sub Command5_Click()
> >> On Error GoTo Err_Command5_Click
> >>
> >> Dim stAppName As String
> >>
> >> stAppName = "I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"
> >> Call Shell(stAppName, 1)
> >>
> >> Exit_Command5_Click:
> >> Exit Sub
> >>
> >> Err_Command5_Click:
> >> MsgBox Err.Description
> >> Resume Exit_Command5_Click
> >>
> >> End Sub
> >>
> >>
> >> or another one:
> >> Private Sub runCA_Click()
> >>
> >> Dim FilePath As String
> >>
> >> FilePath = "I:\Corporate\Credit\LOTUS\COLLECTI\ACCESS\ddrcath.mdb"
> >> Application.FollowHyperlink FilePath
> >>
> >>
> >> End Sub
> >>
> >> Please, can somebody help? Thank you.
> >>

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use file I/o codes with form and controls codes Allen Microsoft ASP .NET 1 3rd Dec 2007 01:04 AM
RegEx replace of html codes to ascii codes Greg -- Microsoft ASP .NET 4 9th Aug 2005 09:27 PM
Re: Query to look up a number of zip codes or area codes for bulkmail MGFoster Microsoft Access Queries 5 16th Apr 2005 05:38 AM
WM_NOTIFY hook works but notification codes are wrong Liran Shahar Microsoft Dot NET Compact Framework 0 25th Nov 2003 09:16 PM
where are the wrong codes??? I can't find. Tao Lei Microsoft ADO .NET 5 26th Oct 2003 03:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:10 AM.