Multiple-criteria search on form, to open form

I know that there are queries that can do this, but I want to try to get this 
functionality on a form looking like this.  After clicking 'Search', a table 
should return the filtered information.  Please let me know if this is 
possible, and HOW to do it... preferably step by step?  Thank you in advance. 
 If all fields are empty, should return ALL records in table, correct?

_______________________________
|Enter search criteria below              |
|               ___________                  |
|Name      |   John        |                  |
|              |__________|                  |
|               ___________                  |
|Amount $ |   $50         |                 |
|               |__________|                 |
|                ___________                 |
|Date (pick)|                 |                 |
| -On         |                  |                |
| -Between |__________|                |
|          ______________                  |
|          |_S_e_a_r_c_h_| <--button  |
|______________________________|
0
Utf
2/17/2010 8:11:02 PM
access.forms 6864 articles. 2 followers. Follow

2 Replies
2121 Views

Similar Articles

[PageSpeed] 25

Sorry, not to 'open form' to open 'filtered table' or 'query' ??

"Mac" wrote:

> I know that there are queries that can do this, but I want to try to get this 
> functionality on a form looking like this.  After clicking 'Search', a table 
> should return the filtered information.  Please let me know if this is 
> possible, and HOW to do it... preferably step by step?  Thank you in advance. 
>  If all fields are empty, should return ALL records in table, correct?
> 
> _______________________________
> |Enter search criteria below              |
> |               ___________                  |
> |Name      |   John        |                  |
> |              |__________|                  |
> |               ___________                  |
> |Amount $ |   $50         |                 |
> |               |__________|                 |
> |                ___________                 |
> |Date (pick)|                 |                 |
> | -On         |                  |                |
> | -Between |__________|                |
> |          ______________                  |
> |          |_S_e_a_r_c_h_| <--button  |
> |______________________________|
0
Utf
2/17/2010 8:14:01 PM
Mac -

They way to do this is to build your filter when the Search button is 
clicked.  Then open the form to show the recrods using the criteria.  Here is 
the shell of the code for your button_click event.  You will need to change 
all names to match your form, control, and fieldnames. 

Dim strCriteria as String

strCriteria = ""

If len(Me.Name) > 0 Then
   strCriteria = "WHERE [fldName] = '" & Me.Name & "'"
End If

If nz(Me.Amount,0) <> 0 Then
   If strCriteria = "" Then
      strCriteria = "WHERE [fldAmount] = " & Me.Amount 
   Else
      strCriteria = strCriteria & " AND [fldAmount] = " & Me.Amount 
   End If
End If

If (nz(Me.Date1,0) <> 0) AND (Me.optDate = 1) Then   'On date chosen
   If strCriteria = "" Then
      strCriteria = "WHERE [fldDate] = #" & Me.Date1 & "#" 
   Else
      strCriteria = strCriteria & " AND [fldDate] = #" & Me.Date1 & "#" 
   End If
End If

If (nz(Me.Date1,0) <> 0) AND (Me.optDate = 2) Then   'Between Dates chosen
   If strCriteria = "" Then
      strCriteria = "[fldDate] >= #" & Me.Date1 & "#" 
   Else
      strCriteria = strCriteria & " AND [fldDate] >= #" & Me.Date1 & "#" 
   End If

   If (nz(Me.Date2,0) <> 0) Then
      strCriteria = strCriteria & " AND [fldDate] <= #" & Me.Date2 & "#" 
   End If
End If

' Now open the form to show the records, and pass in this criteria:

DoCmd.OpenForm "FormName", acNormal, , strCriteria
-- 
Daryl S


"Mac" wrote:

> Sorry, not to 'open form' to open 'filtered table' or 'query' ??
> 
> "Mac" wrote:
> 
> > I know that there are queries that can do this, but I want to try to get this 
> > functionality on a form looking like this.  After clicking 'Search', a table 
> > should return the filtered information.  Please let me know if this is 
> > possible, and HOW to do it... preferably step by step?  Thank you in advance. 
> >  If all fields are empty, should return ALL records in table, correct?
> > 
> > _______________________________
> > |Enter search criteria below              |
> > |               ___________                  |
> > |Name      |   John        |                  |
> > |              |__________|                  |
> > |               ___________                  |
> > |Amount $ |   $50         |                 |
> > |               |__________|                 |
> > |                ___________                 |
> > |Date (pick)|                 |                 |
> > | -On         |                  |                |
> > | -Between |__________|                |
> > |          ______________                  |
> > |          |_S_e_a_r_c_h_| <--button  |
> > |______________________________|
0
Utf
2/22/2010 6:23:02 PM
Reply:

Similar Artilces:

Removing multiple hyperlinks
I've got data copied into my spreadsheet that includes hyperlinks. Ther are thousands of these in a column. I can remove individually by right-clicking and selecting Hyperlink an Remove. I can then arrow down and do a control Y, cell by cell, What I want to do is highlight the column and be able tp remove th hyperlinks all at once. I've exhausted myself peering through knowlegebases and groups, bu cannot find any way to make this work. Thanks for any input you can provide -- Message posted from http://www.ExcelForum.com Hi one way: Use the following macro to remove hyperlinks...

Create a list with multiple criteria
I have a data base with 1,000's of addresses w/zipcodes (Sheet 1 columns A to E, E being zipcodes). After setting a base address I get all of the zipcodes within a given radius (in this case 70 zipcodes), listed in Sheet 2, Column A. Next, I use COUNTIF (in column B) to find how many addresses are in each zipcode, in this example there are 46 addresses within the 70 zipcodes. What I want to do is create a list in sheet three that will list each with the data from Sheet 1 columns A to E). Any help would be appreciated. Ronbo ...

Charting multiple multiples
Hopefully I can explain this in a way that will be understood. Data: Place A Place B Place C FWD Back FWD BACK FWD Back Org_1 1 2 3 2 1 3 Org_2 2 5 4 6 1 4 I would like to place the data so that FWD and Back data is stacked on top of each other in different colors, and placed in one row on a 3-D chart as Org-1 and a second row as Org_2. Any ideas? Thanks. If you arrange your data like this: Back FWD Org_1 Place A 2 1 Place B 2 3 Place C 3 1 Org_2 Place A 5 2 ...

Multiple Hyperlinks In Same Shape Doesn't Work
Can anyone tell me how I can get multiple hyperlinks in the same shape to work? I have no problem inserting the hyperlinks, but they all point to only one. I scoured these posts, and found this (http://groups.google.com/groups?q=hyperlink+group:microsoft.public.visio.*&hl=en&lr=&ie=UTF-8&oe=UTF-8&group=microsoft.public.visio.*&selm=3eea6467%241%40news.microsoft.com&rnum=2), which doesn't appear to work. Thanks in advance-- RAD Um, which version of Visio are you using? As far as I know, at least Visio 2002 and Visio 2003 support multiple hyperlinks. Can't...

Attempting to display only certain records related to user criteria input
I have an Excel spreadsheet with 100 records. Each record contains columns of information with one of those columns being age. What would like to do is have the user fill in a cell at the top of the pag and then have only those records meeting that criteria be displayed. For example, "Show records where age exceeds ____". If the user input 34 in the blank, then only those records where the value in the ag column exceeds 34 would be displayed. If the user then changes thei input to 15, then only those records where the value in the age colum exceeds 15 would be displayed. At fi...

Multiple Profiles, multiple accounts, multiple machine configuring?
Is there a vb or related method of adding *both* profiles *and* email accounts to multiple users logins from the administrator account? I have a network which is a workgroup (NOT a domain), in which there are about 15 users that are replicated on each of 5 machines. I'd like to be able to add all 15 Mail Profiles, and all 15 email accounts to each of the 15 logins on these 5 machines--obviously with as little work as possible. The mail is all retrieved from the same Exchange Server, but these machines *cannot* be added to a domain (don't ask!). I'd hate to have to log into ...

Counting dates with specific criteria
Hi, I have a column with various dates, I need some formulae to count different criteria. The criteria are: 1. Dates in the current month. 2. Dates last month. 3. dates in a calender year. 4. Dates in a financial year. Each criteria will be shown in seperate cells on a different worksheet on Excel 2003, also the current month is always the current month as we progress through the year. Thanks in advance, -- Steve Try these... 1. Dates in the current month. =SUMPRODUCT(--(TEXT(A2:A21,"myyyy")=TEXT(NOW(),"myyyy"))) 2. Dates last month. =SUMPRO...

Single click selects multiple cells
When clicking on a single cell multiple cells are selected. The one time solution for this is to zoom in or out. This is problematic as 60% seems to be the zoom that works most of the time but at this zoom level the cell contents do not display. The time lost and the frustration that builds is killing my productivity and office attitude. Please give all of us a permanet fix. -- Thanks Mike ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" butt...

Open Group Default ???
Does anyone know if I can set all my grouped shapes to open in their own window by default - like they do in Visio 5 ? ...

Suppressing Values in Autofilter Criteria List
Hello, I'm not a VBA guy, but I think what I'm trying to do can only get done with some lines of code. Any help would be appreciated. I've a fairly large data set that I'd like to be able to apply advanced filters to. I would like the source table for criteria to update automatically based on values from other criteria entered. For example: Column A could be Region. Column B could be job. Column C could be Salary Grade. I would like, should I choose East Region, for the list of possible jobs to be then updated automatically to exclude any jobs that are ...

distributing data into multiple cells
hii i have to prepare an exel sheet of some 2000 products..i have to copy d data from the net and then prepare the sheet,with 4 different columns for 4 diff types of entries..now when i copy data nad paste is as text.it all goes in a single cell in a row .how can i distribute the data l into multiple cells????????? -- jaspreet ------------------------------------------------------------------------ jaspreet's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=23821 View this thread: http://www.excelforum.com/showthread.php?threadid=374772 can you show some samp...

Position of Minimised Form
Hi, I have a form that user can minimise once they have select filter information for a report. My problem is when the form is minimised it obscures the page select controls of the report. Has anyone got any code suggestion so that the minimised form can be reposition to say the bottom right-hand side? Thank you for any help On Mon, 25 Feb 2008 21:19:02 GMT, d@by.co.uk wrote: > Hi, > I have a form that user can minimise once they have select filter > information for a report. > My problem is when the form is minimised it obscures the page select > controls of the report. >...

Is there a way to sort multiple columns with a tab or something?
I have a 4 column spreadsheet. I want to be able to click the heading for each of the columns to hav them sort by that column if clicked. How do I do that -- Message posted from http://www.ExcelForum.com Hi why not used the soprt icon for this. Note: This could screw up your sorting if Excel does not recognize your database columns correctly -- Regards Frank Kabel Frankfurt, Germany > I have a 4 column spreadsheet. > > I want to be able to click the heading for each of the columns to have > them sort by that column if clicked. How do I do that? > > > --- > Mess...

Sending to multiple addresses
How do I send an email to multiple addresses having only the recipient see their own email address? Michelle wrote: > How do I send an email to multiple addresses having only > the recipient see their own email address? Put the addresses into the BCC: field. Note that many e-mail programs will decide such mails are spam though. >-----Original Message----- >How do I send an email to multiple addresses having only >the recipient see their own email address? >. Open your new email and go to tools, select recipient, when your address book opens select (highlight) the a...

multiple selection
How can I select multiple records into a list box? I want that for append identical records (for select records) in another table. Many thanks Florin Use a subform instead of a list box. In a subform bound to a related table, you can append as many rows as applicable. It is possible (but not simple) to use an unbound multi-select list box that is populated in the Current event of the form, and executes Append, Delete, and Update query statements based on the ItemsSelected if they are changed. You will also have to find a way to respond to the user "undoing" changes. -- Al...

Exchange 2000 Distribution Lists
Hello We are running an Exchange 2000 environment in Exchange Native Mode and Windows Mixed Mode. We just converted from Exchange 5.5 Is there any way to configure multiple people to be owners or editors of the distribution lists? This was possible in 5.5, but we cannot find a means of accomplishing this in 2000 Any help would be appreciated Thank yo Jason "Jason P.S." <jason.pruden-shebaylo@investorsgroup.com> wrote: >We are running an Exchange 2000 environment in Exchange Native Mode and Windows Mixed Mode. We just converted from Exchange 5.5. > >Is there any w...

Closing workbook open as CSV
I open a CSV file in Excel, Copy two columns of data, paste the data into another workbook and then I want to cloes the CSV file without getting a prompt about saving the data to the clipboard. I am using Application.ActiveWindow.Close (False) to close the file but I'm still getting the prompt to save the data. Is there another command I should use? Thanks, Sam First, I don't go through the Windows collection. I just close the workbook. Dim CSVWkbk as workbook 'other code here 'open the csv file Workbooks.Open Filename:="somepath\somename.csv&quo...

Need to have a dropdown list containing multiple rows
I am setting up an form and need to create a dropdown list that will contain 8 sets of data. Each set needs to contain 3 rows of data (name, street address & city/state/zip. The goal is to allow the user to click onto the cell, see the dropdown and select which address set to use. This would then place the data into three rows suitable for mailing. I have never attempted anything like this and am in need of assistance. Thank you. --- Message posted from http://www.ExcelForum.com/ Pat What you ask is easily done using Data Validation drop-down list and a few Vlookups but........Ex...

How to hide form from grid 2 to 4
I have a form that I’m using as main form menu, I need three different portions to be able to hide and view. I know how to hide acDetail section, Heared or footer but do not know how to hide a potion of the form only, i.e.: on detail section hide form from grid 2 to 4. Any help, tip or comment is greatly appreciated, Adnan hi Adnan, Adnan wrote: > I have a form that I’m using as main form menu, I need three different > portions to be able to hide and view. I know how to hide acDetail section, > Heared or footer but do not know how to hide a potion of the form only, i.e.: >...

Open Quark files in Publisher??
Is there any possible way to open a Quark file in Publisher? Hi MarkG (markg@jflv.org), in the newsgroups you posted: || Is there any possible way to open a Quark file in || Publisher? Nope. You would have to: 1. Attempt to use a copy/paste or drag/drop 2. Export the Quark pages as images supported by Publisher and insert them as images. 3. Export the Quark publication as a Word/RTF/Text item (less the images) and import the text only into Publisher 4. Export the Quark publication as a PDF, the go to ScanSoft.com and get the PDF software for Word/Publisher that allows you to import PDF...

Combine multiple tables into one
I took over a database in which the last person created a new table for everyday worth of data (ie. Feb-21-08 is named 022108). There are over 100 tables in the single database with the same columns and table attributes, I would like to combine all of these tables into one where I have a Date_Key field in place of the table name. I figured out how to query the table names using the following: SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>"~") AND (Left$([Name],4) <> "Msys") AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name; Now I j...

Multiple domains #6
Hi, Having done some research I have found that it is possible to send and receive email from multiple domains with Exchange 2003. I have a few questions that I would like cleared up if anyone can help. 1. Is it really as simple as configuring a recipient policy for the new domain and then changing the mail record for that domain to point to the proper IP address? 2. If I set up a new account in AD, and need this account to be associated with the second email domain, will the default SMTP email be for the first domain? If so, can I just edit this directly? 3. If I set the default SMTP add...

forwarding mail to multiple external addresses
I have a user on our Exchange Server 2003 that wants his email to be forwarded to 2 different external email addresses and not have the original mail stored in his exchange mailbox at all. I can set this up to froward to only one external email address by creating a contact in Active Directory with an external email address and then forwarding to that contact. However, it won't allow me to forward to multiple contacts. Please help as this seems like a pretty common request from several users. I'm not sure, as I haven't tested it before, but you might be able to create a ...

Finding Data in multiple worksheets
Using Excel 2000, how can I find data in multiple worksheets; example: any number between 200 & 299 in 32 worksheets? If you mean you want to find a single number across 32 worksheets, group your worksheets (click on the first, ctrl-click on subsequent (or even shift-click)). Then Edit|Find But I think I'd use Jan Karel Pieterse's FlexFind: http://www.oaltd.co.uk/MVP/ If you meant you wanted to find all 100 numbers (200-299) in all 32 sheets, then I think I'd have a macro search for each number and report the results on a new worksheet. "mark@southwestconst.com&quo...

Last Record On A Continuous Form (Problem)...
Thanks in advance for reading this, and again for any help you can offer. I have a database where as the user does things, a table gets populated. Let's call it tblData. At some point in the work process, a form is called, frmProblem. This is a continuous form (with no subforms) that is bound to tblData. Using textboxes, it correctly displays the records from the table in a list. This part works fine. To keep the user from entering a new record at this point, the Allow Additions property of frmProblem is set to "No" in the property sheet. This also works fine, and the display o...