<-> Help me with this code 
Author Message
 <-> Help me with this code

This code works great to search 31 files by a specific month and year, but I
need it to be able to search by an entire year.  All the files that it searches
were saved as 'Month & Day & Year & .dat' so the filename would be something
like september31998.dat.  Right now this works fine for searching files by the
entire month.  However, I need it to be able to search for a string in all
files ending with 1998.dat.  A wildcard character doesn't seem to work here, so
could anyone take a look at my monthly search and try to help me get a yearly
search?

Private Sub cmdGo_Click()
  Dim FoundIt As Boolean
  Dim AnyFound As Boolean
  Dim FileList(30) As String
  Dim t, fcnt, errno
  Dim Dat As String
  Dim Srch As Integer
  Dim SelMonth As String
  Dim sel As String

List1.Clear
List1.AddItem "Entry File Matches:"

    For t = 0 To 30
        FileList(t) = App.Path & "\" & Combo3.Text + LTrim$(Str(t + 1)) +
Combo4.Text & ".dat"
   Next

'Combo3 is the selected month, Combo4 is the selected year

   AnyFound = False
   For fcnt = 0 To 30
     errno = 0
     On Error GoTo fileerr
     Open FileList(fcnt) For Input As 1
     On Error GoTo 0
     If errno = 0 Then
       FoundIt = False
       Do While Not EOF(1)
         Line Input #1, Dat
         Srch = InStr(1, Dat, txtHidden.Text)
         If Srch <> 0 Then
           FoundIt = True
           AnyFound = True
           Exit Do
         End If
       Loop
       If FoundIt = True Then List1.AddItem FileList(fcnt)
       Close #1
     End If
   Next fcnt
   If AnyFound = False Then List1.AddItem "No Matches Found"    'Puts this in
only once.
   Exit Sub       'You must use exit sub so you don't go into error routine.

fileerr:
   errno = Err
   Resume Next
End Sub
--Always 'E-Mail to Author'

-- http://www.*-*-*.com/
--My System:
AMD K6-266Mhz
64MB SDRAM
4.3GB UDMA HD
3D 4MB Video Card (AGP)
Yamaha Wavetable 3D Sound
SupraMAX 56K
--Software:
AOL 4.0 rev134.214a
Windows98 (build 1998)



Thu, 22 Feb 2001 03:00:00 GMT  
 <-> Help me with this code
Without rewriting your code, what you could do is
1.  Have the filelist fill by giving it a .path of wherever your data files
are and a .pattern of *.dat
2.  Have maybe a for-next loop go from 0 to .listcount-1
    For temp% = 0 To File1.ListCount - 1
        If InStr(1, File1.List(temp%), "1998") Then
            ..your code to search through that found file and do whatever..
        End If
    Next temp%

Mark.

--
*****
The  secret  of success is sincerity.  Once you  can  fake  that you've got
it made.

|This code works great to search 31 files by a specific month and year, but
I
|need it to be able to search by an entire year.  All the files that it
searches
|were saved as 'Month & Day & Year & .dat' so the filename would be
something
|like september31998.dat.  Right now this works fine for searching files by
the
|entire month.  However, I need it to be able to search for a string in all
|files ending with 1998.dat.  A wildcard character doesn't seem to work
here, so
|could anyone take a look at my monthly search and try to help me get a
yearly
|search?
|



Thu, 22 Feb 2001 03:00:00 GMT  
 <-> Help me with this code
Thanks but, I'm a complete idiot and need it simpler.  
--Always 'E-Mail to Author'

--http://come.to/updatedpc
--My System:
AMD K6-266Mhz
64MB SDRAM
4.3GB UDMA HD
3D 4MB Video Card (AGP)
Yamaha Wavetable 3D Sound
SupraMAX 56K
--Software:
AOL 4.0 rev134.214a
Windows98 (build 1998)


Fri, 23 Feb 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. <<<<<<<<ComboBox>>>>>>>>>>>>

2. HELP >>>>>>WIN API <<<<<<<<<<

3. <><><>HELP<><><> PCMCIA Motorola Montana 33.6

4. help me out please!!!!<<<<<<<<<<<<<<<<<<<<<<<thanks>>>>>>>>>>>>>>>>>>>>>>>>

5. >>>>HELP ME WITH DATEVALUE IN UK FORMAT<<<<<<<

6. >>>>> URGENT: PLEASE HELP <<<<<

7. >>>> HELP:: URGENT<<<<<<

8. <<<<HELP- OLE container Control>>>>>>>>>

9. VB5<->RDO2<->ODBC<->ORACLE Procedure Problem

10. <<<Cneck Box>>>

11. <<<Gif Files>>>

12. <<<CD ROM>>>

 

 
Powered by phpBB® Forum Software