PC Review


Reply
Thread Tools Rate Thread

How do I create a search form using a query (not using filters)

 
 
Dante
Guest
Posts: n/a
 
      15th Nov 2008
I am working in MsAccess 2003 (though I save my Databases in Access 2000
format). I read the Allen Browne post on the search form using a filter, and
it was good. However, I started getting the error of "There isn't enough
memory to perform this operation. Close unneeded programs and try the
operation again". I have a lot of records (4,200+) and more will be inputted
into it. Is there a way to create a search form that will just query the
results and list in a list box?

It's a database that I keep for a library of books.

I have the following fields: Title, Copyright, Printing, Additional Data,
Type, Category and Box #.

Thanks!
 
Reply With Quote
 
 
 
 
Pete D.
Guest
Posts: n/a
 
      15th Nov 2008
4200 records is not alot, might post the code that you are using for the
search. Sounds like you have an error in it.

"Dante" <(E-Mail Removed)> wrote in message
news:6DC2CDE5-1492-44B0-B2AF-(E-Mail Removed)...
>I am working in MsAccess 2003 (though I save my Databases in Access 2000
> format). I read the Allen Browne post on the search form using a filter,
> and
> it was good. However, I started getting the error of "There isn't enough
> memory to perform this operation. Close unneeded programs and try the
> operation again". I have a lot of records (4,200+) and more will be
> inputted
> into it. Is there a way to create a search form that will just query the
> results and list in a list box?
>
> It's a database that I keep for a library of books.
>
> I have the following fields: Title, Copyright, Printing, Additional Data,
> Type, Category and Box #.
>
> Thanks!



 
Reply With Quote
 
Ken Snell \(MVP\)
Guest
Posts: n/a
 
      15th Nov 2008
I have a sample database that shows how to build an SQL string's WHERE
clause based on values in various controls on a form:

Building SQL string based on values entered into controls
http://www.accessmvp.com/KDSnell/Sam...htm#FilterForm

You could use a setup similar to this to construct the SQL statement for
your listbox.

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


"Dante" <(E-Mail Removed)> wrote in message
news:6DC2CDE5-1492-44B0-B2AF-(E-Mail Removed)...
>I am working in MsAccess 2003 (though I save my Databases in Access 2000
> format). I read the Allen Browne post on the search form using a filter,
> and
> it was good. However, I started getting the error of "There isn't enough
> memory to perform this operation. Close unneeded programs and try the
> operation again". I have a lot of records (4,200+) and more will be
> inputted
> into it. Is there a way to create a search form that will just query the
> results and list in a list box?
>
> It's a database that I keep for a library of books.
>
> I have the following fields: Title, Copyright, Printing, Additional Data,
> Type, Category and Box #.
>
> Thanks!



 
Reply With Quote
 
Dante
Guest
Posts: n/a
 
      17th Nov 2008
Thanks Pete. I agree that 4,200+ is not a lot. However, I was getting that
error. I went to the Microsoft website and they had a page where there was a
module code to use, which seems to work. I've not had that message again,
however I'm still having trouble with this form. My code is below.

I would like to use SQL or a Query, as opposed to using a filter though.
But if the filter works, then that's fine.


Private Sub cmdSearch_Click()

Dim strWhere As String
Dim lngLen As Long

If Not IsNull(Me.txtTitle) Then
strWhere = strWhere & "([Title] Like ""*" & Me.txtTitle & "*"") AND "
End If

If Not IsNull(Me.txtCopy) Then
strWhere = strWhere & "([Copyright] Like ""*" & Me.txtCopy & "*"")
AND "
End If

If Not IsNull(Me.txtPrint) Then
strWhere = strWhere & "([Printing] Like ""*" & Me.txtPrint & "*"")
AND "
End If

If Not IsNull(Me.txtAddData) Then
strWhere = strWhere & "([AddData] Like ""*" & Me.txtAddData & "*"")
AND "
End If


If Not IsNull(Me.AddData) Then
strWhere = strWhere & "([AddData] Like ""*" & Me.txtAddData & "*"")
AND "
End If

If Not IsNull(Me.txtType) Then
strWhere = strWhere & "([Type] Like ""*" & Me.txtType & "*"") AND "
End If

If Not IsNull(Me.txtCat) Then
strWhere = strWhere & "([Cat] Like ""*" & Me.txtCat & "*"") AND "
End If

If Not IsNull(Me.txtBox) Then
strWhere = strWhere & "([Box] Like ""*" & Me.txtBox & "*"") AND "
End If


lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No text indicated to search for", vbInformation, "Error"
Else
strWhere = Left$(strWhere, lngLen)

Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub



"Pete D." wrote:

> 4200 records is not alot, might post the code that you are using for the
> search. Sounds like you have an error in it.
>
> "Dante" <(E-Mail Removed)> wrote in message
> news:6DC2CDE5-1492-44B0-B2AF-(E-Mail Removed)...
> >I am working in MsAccess 2003 (though I save my Databases in Access 2000
> > format). I read the Allen Browne post on the search form using a filter,
> > and
> > it was good. However, I started getting the error of "There isn't enough
> > memory to perform this operation. Close unneeded programs and try the
> > operation again". I have a lot of records (4,200+) and more will be
> > inputted
> > into it. Is there a way to create a search form that will just query the
> > results and list in a list box?
> >
> > It's a database that I keep for a library of books.
> >
> > I have the following fields: Title, Copyright, Printing, Additional Data,
> > Type, Category and Box #.
> >
> > Thanks!

>
>
>

 
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 do I create a clear filters button in a form? Xtremist9 Microsoft Access VBA Modules 1 15th Apr 2010 08:18 PM
Create Two Filters in Form to Execute Report. mlieberstein Microsoft Access Forms 6 26th Jun 2009 03:20 PM
Allow filters on subform if main form Allow Filters set to no =?Utf-8?B?TG91dmVycmls?= Microsoft Access Forms 0 25th Sep 2007 11:10 AM
Create a search function on a form that can search by 2 or more cr =?Utf-8?B?dnVsY2FuODg=?= Microsoft Access VBA Modules 3 22nd Apr 2005 02:04 PM
Create a Search Form and Generate a Report based on the Search Form ace Microsoft Access 1 4th Nov 2004 04:07 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:52 AM.