Kaup, Chester
Chester_Kaup at kindermorgan.com
Wed Apr 13 15:34:35 CDT 2011
Problem found! -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Wednesday, April 13, 2011 3:30 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Dir command trouble "Pablic" ? :-) -- Stuart On 13 Apr 2011 at 15:24, Kaup, Chester wrote: > I found my mistake just as you responded. A one character error in the > path name. Thanks for the assistance. > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart > McLachlan Sent: Wednesday, April 13, 2011 3:16 PM To: Access > Developers discussion and problem solving Subject: Re: [AccessD] Dir > command trouble > > It works for me on "C:\" > > Sub FileFolderLIst() > Dim FileFolder As Variant > Dim strPathname As String > strPathname = "C:\" > FileFolder = Dir(strPathname) > FileFolder = Dir(strPathname, vbDirectory) > Debug.Print FileFolder > End Sub > > > As does the example in A2K3 Help under Dir() - which show how to > *only* list the directories rather all files as well. > > Sub Test() > Dim MyPath As String > Dim MyName As String > MyPath = "c:\" ' Set the path. > MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry. > Do While MyName <> "" ' Start the loop. > ' Ignore the current directory and the encompassing directory. If > MyName <> "." And MyName <> ".." Then > ' Use bitwise comparison to make sure MyName is a directory. > If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory > Then > Debug.Print MyName ' Display entry only if it > End If ' it represents a directory. > End If > MyName = Dir ' Get next entry. > Loop > End Sub > > > > > On 13 Apr 2011 at 14:22, Kaup, Chester wrote: > > > I am running the following code to get a list of file folders. All > > it returns is an empty string. What might I be missing? > > > > Sub FileFolderLIst() > > > > Dim FileFolder As Variant > > > > strPathName = "M:\SACROC\Data\Pablic\Step-Rate Tests\Area 2\" > > FileFolder = Dir(strPathName) > > FileFolder = Dir(strPathName, vbDirectory) > > > > End Sub > > > > > > Chester Kaup > > Engineering Technician > > Kinder Morgan CO2 Company, LLP > > Office (432) 688-3797 > > FAX (432) 688-3799 > > > > > > No trees were killed in the sending of this message. However a large > > number of electrons were terribly inconvenienced. > > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com