A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

nightmare search



 
 
Thread Tools Display Modes
  #1  
Old May 25th, 2004, 05:44 PM
bleep
external usenet poster
 
Posts: n/a
Default nightmare search


Hi i'm new to access and am totally confused with searches. I have a
form the has a subform contained in it. The main form has a number of
combo boxes on it. i need to be able to select a value in one of the 10
combo boxes on my form click a search button and then filter the data
according to the value selected. I've tried using queries and they dont
seem to work i dont know any visual basic so am really struggling with
this. would anyone be able to help me please?
Thanks
Faye


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #2  
Old May 26th, 2004, 10:11 AM
Steve Schapel
external usenet poster
 
Posts: n/a
Default nightmare search

Faye,

Do you mean that each of the 10 comboboxes is for entry of a criteria
for each of 10 corresponding fields in your query? But you will only
ever want to enter criteria for one of them at any given time? Maybe an
example would help to know what you are doing.

--
Steve Schapel, Microsoft Access MVP


bleep wrote:
Hi i'm new to access and am totally confused with searches. I have a
form the has a subform contained in it. The main form has a number of
combo boxes on it. i need to be able to select a value in one of the 10
combo boxes on my form click a search button and then filter the data
according to the value selected. I've tried using queries and they dont
seem to work i dont know any visual basic so am really struggling with
this. would anyone be able to help me please?
Thanks
Faye

  #3  
Old May 26th, 2004, 06:53 PM
Bruce
external usenet poster
 
Posts: n/a
Default nightmare search

First, you can right click on a field and choose Filter by
Selection. Below I describe a button for removing the
filter, or you can do so from the toolbar. It depends on
who will be using the database.
With much help from this group, I came up with a form-
based solution to a similar problem (assuming I understand
you correctly). I used unbound combo boxes for the search
rather than using cotrols that are bound to a source in
the table or query. For instance, I placed in the form
header an unbound combo box (cboLookupSubject) to look up
the value in the field [Subject] in the form Detail
section. In the combo box's After Update event I placed
the following code:
DoCmd.ApplyFilter , "[Subject]='" & cboLookupSubject & "'"
[Subject] is a text field; I believe the code for a number
field would be:
DoCmd.ApplyFilter , "[Subject]= " & cboLookupSubject
Do the same for the rest of your fields. I put the combo
boxes in the header, and made the header invisible. A
command button on the form makes the header visible when I
want to conduct a search.
The row source for the combo box is a query. With the
combo box selected in design view, right click and select
Properties. This opens what is known as the Property
Sheet. Click the Data tab, and click Row Source. Click
the three dots on the right side of the row. Select the
table from the list, click Add, then Close. Double click
Subject (to use my example) in the top part of the
window. In the grid, click Sort and choose ascending. If
you have the same words in [Subject] for many records,
right click the top part (next to, not in, the table),
click Properties, and set Unique Values to Yes. Close the
window, and save when prompted. You can click Save and
give the query a name, if you like.
Similarly, when I say that code needs to go in the After
Update event, select the combo box and open the property
sheet. At the event tab, click After Update, click the
three dots, click Code Builder, then OK. Insert the code
at the blinking cursor.
You might want to put a button on the form, with its Click
event set to: Me.FilterOn = False. This will let you see
all of the records again after you have filtered them.
The combo box wizard might help. Make sure the magic wand
in the toolbox is highlighted, then click combo box, then
click the form and follow the prompts.

-----Original Message-----
Faye,

Do you mean that each of the 10 comboboxes is for entry

of a criteria
for each of 10 corresponding fields in your query? But

you will only
ever want to enter criteria for one of them at any given

time? Maybe an
example would help to know what you are doing.

--
Steve Schapel, Microsoft Access MVP


bleep wrote:
Hi i'm new to access and am totally confused with

searches. I have a
form the has a subform contained in it. The main form

has a number of
combo boxes on it. i need to be able to select a value

in one of the 10
combo boxes on my form click a search button and then

filter the data
according to the value selected. I've tried using

queries and they dont
seem to work i dont know any visual basic so am really

struggling with
this. would anyone be able to help me please?
Thanks
Faye

.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:57 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.