PC Review


Reply
Thread Tools Rate Thread

Application.Filesearch in a Runtime program

 
 
Matt
Guest
Posts: n/a
 
      16th Oct 2008
I have an application that works fine on my development machine. It has
Access 2003. However, when I package it up into a runtime application, there
is a part of the code that doesn't seem to work and I can't figure out what
I'm missing to make it work for the runtime version. Everything seems to
work fine, but this part of the code never discovers the file and I'm
positive that the file exists where it is supposed to. The code is below.
Am I possibly missing some reference files or something? It appears to be
installing Runtime Version 2002 when I run the install package. Thanks in
advance.

Private Sub Form_Timer()
'searches for DataBaseOn.txt every minute.
'if not found, quits Access
Dim fs
Set fs = Application.FileSearch

With fs
.NewSearch
.LookIn = "\\Srvrghq\inventory"
.SearchSubFolders = False
.FileName = "DataBaseOn.txt"
If .Execute = 0 Then
'display a form with a message
DoCmd.OpenForm "frmClock", , , , , acDialog
'get out
Application.Quit

End If
End With

End Sub
 
Reply With Quote
 
 
 
 
Klatuu
Guest
Posts: n/a
 
      16th Oct 2008
It is most likely a reference issue in VBA, but for what you are doing, a
filesearch is massive overkill. All you really need is the Dir function:

Private Sub Form_Timer()
'searches for DataBaseOn.txt every minute.
'if not found, quits Access

If Dir(\\Srvrghq\invinventory\DataBaseOn.txt) = vbNullString Then
'display a form with a message
DoCmd.OpenForm "frmClock", , , , , acDialog
'get out
Application.Quit
End If

End Sub


"Matt" <(E-Mail Removed)> wrote in message
news64BA91A-94B3-4A99-8243-(E-Mail Removed)...
>I have an application that works fine on my development machine. It has
> Access 2003. However, when I package it up into a runtime application,
> there
> is a part of the code that doesn't seem to work and I can't figure out
> what
> I'm missing to make it work for the runtime version. Everything seems to
> work fine, but this part of the code never discovers the file and I'm
> positive that the file exists where it is supposed to. The code is below.
> Am I possibly missing some reference files or something? It appears to be
> installing Runtime Version 2002 when I run the install package. Thanks in
> advance.
>
> Private Sub Form_Timer()
> 'searches for DataBaseOn.txt every minute.
> 'if not found, quits Access
> Dim fs
> Set fs = Application.FileSearch
>
> With fs
> .NewSearch
> .LookIn = "\\Srvrghq\inventory"
> .SearchSubFolders = False
> .FileName = "DataBaseOn.txt"
> If .Execute = 0 Then
> 'display a form with a message
> DoCmd.OpenForm "frmClock", , , , , acDialog
> 'get out
> Application.Quit
>
> End If
> End With
>
> End Sub



 
Reply With Quote
 
Matt
Guest
Posts: n/a
 
      16th Oct 2008
Thanks you so much. That solved my problem.

"Klatuu" wrote:

> It is most likely a reference issue in VBA, but for what you are doing, a
> filesearch is massive overkill. All you really need is the Dir function:
>
> Private Sub Form_Timer()
> 'searches for DataBaseOn.txt every minute.
> 'if not found, quits Access
>
> If Dir(\\Srvrghq\invinventory\DataBaseOn.txt) = vbNullString Then
> 'display a form with a message
> DoCmd.OpenForm "frmClock", , , , , acDialog
> 'get out
> Application.Quit
> End If
>
> End Sub
>
>
> "Matt" <(E-Mail Removed)> wrote in message
> news64BA91A-94B3-4A99-8243-(E-Mail Removed)...
> >I have an application that works fine on my development machine. It has
> > Access 2003. However, when I package it up into a runtime application,
> > there
> > is a part of the code that doesn't seem to work and I can't figure out
> > what
> > I'm missing to make it work for the runtime version. Everything seems to
> > work fine, but this part of the code never discovers the file and I'm
> > positive that the file exists where it is supposed to. The code is below.
> > Am I possibly missing some reference files or something? It appears to be
> > installing Runtime Version 2002 when I run the install package. Thanks in
> > advance.
> >
> > Private Sub Form_Timer()
> > 'searches for DataBaseOn.txt every minute.
> > 'if not found, quits Access
> > Dim fs
> > Set fs = Application.FileSearch
> >
> > With fs
> > .NewSearch
> > .LookIn = "\\Srvrghq\inventory"
> > .SearchSubFolders = False
> > .FileName = "DataBaseOn.txt"
> > If .Execute = 0 Then
> > 'display a form with a message
> > DoCmd.OpenForm "frmClock", , , , , acDialog
> > 'get out
> > Application.Quit
> >
> > End If
> > End With
> >
> > End Sub

>
>
>

 
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
with application.filesearch Rick Microsoft Excel Programming 1 23rd Jan 2009 05:59 PM
How does one get the application name of a C# program at runtime Andrew Falanga Microsoft Dot NET 5 6th Aug 2008 12:45 AM
Application.Filesearch EA Microsoft Excel Programming 3 17th Aug 2006 10:07 AM
FileSearch Problem in Access 2002 RunTime =?Utf-8?B?Rm9vLnNn?= Microsoft Access VBA Modules 3 1st Jun 2006 02:36 PM
Filesearch using Access 2002 runtime Bob Microsoft Access VBA Modules 0 22nd Sep 2003 06:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:33 PM.