TIP: Click on subject to list as thread! ANSI
echo: visual_basic
to: All
from: Vf
date: 2004-11-10 17:26:00
subject: Re: What`s wrong in this

aegeanege{at}yahoo.com (Bar??  ?zmir) wrote in message
news:...
> Which line gives the error?
> 
> 
> 
> meusemailsporcarias{at}yahoo.com.br (VF) wrote in message
news:...
> > Thanks Jan, but I have a error message:
> > 3001 "invalid argument".
> > 
> > VF
> > 
> > Jan Hyde  wrote in
message news:...
> > > meusemailsporcarias{at}yahoo.com.br (VF)'s wild thoughts were
> > > released on 8 Nov 2004 08:37:50 -0800 bearing the following
> > > fruit:
> > > 
> > > >This search engine works very well with a 82kb database
(MYDB001.mdb),
> > > >but it freezes with another file with 1590kb (MYDB002.mdb). What's
> > > >wrong? Is "mydb002" too large? Any tip to
refine this code?
> > >
>--------------------------------------------------------------------------------
> > > >Private Sub cmdSearch_Click()
> > > > Dim db As Database
> > > > Dim rs As Recordset
> > > > Dim SearchString As String
> > > >  SearchString = txtSearch.Text
> > > >    Set db = OpenDatabase(App.Path & "\MYDB002.mdb")
> > > >    Set rs = db.OpenRecordset("Select AUTHOR From
MYTABLE", , _
> > > >             dbForwardOnly)
> > > >  While Not rs.EOF
> > > >   If rs!AUTHOR = SearchString Then
> > > >    lstResults.AddItem rs!AUTHOR
> > > >   End If
> > > >   rs.MoveNext
> > > >  Wend
> > > > rs.Close
> > > > db.Close
> > > >End Sub
> > > 
> > > That is probably the most inefficient way of doing that.
> > > 
> > > Private Sub cmdSearch_Click()
> > >  Dim db As Database
> > >  Dim rs As Recordset
> > >  Dim SearchString As String
> > >  Dim SQL as string
> > >   SearchString = txtSearch.Text
> > > 
> > > 	SQL = "SELECT AUTHOR FROM MYTABLE WHERE AUTHOR = '" &
> > > searchstring & "'"
> > > 
> > >     Set db = OpenDatabase(App.Path & "\MYDB002.mdb")
> > >     Set rs = db.OpenRecordset(SQL, dbForwardOnly)
> > >   While Not rs.EOF
> > >     lstResults.AddItem rs!AUTHOR
> > >    rs.MoveNext
> > >   Wend
> > >  rs.Close
> > >  db.Close
> > > End Sub
> > > 
> > > HOWEVER, taking the code literally you might as well simply
> > > do
> > > 
> > > lstResults.AddItem searchstring
> > > 
> > > 
> > > 
> > > Jan Hyde (VB MVP)


This one:

Set rs = db.OpenRecordset(SQL, dbForwardOnly)

VF
---
þ RIMEGate(tm)/RGXPost V1.14 at BBSWORLD * Info{at}bbsworld.com

---
 * RIMEGate(tm)V10.2áÿ* RelayNet(tm) NNTP Gateway * MoonDog BBS
 * RgateImp.MoonDog.BBS at 11/10/04 5:26:31 PM
* Origin: MoonDog BBS, Brooklyn,NY, 718 692-2498, 1:278/230 (1:278/230)
SEEN-BY: 633/267 270 5030/786
@PATH: 278/230 10/345 106/1 2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.