Filter Data based on Form

Hi All,

I have a form that is based on a query. I also have a unbound list box that
the user can select a location from. The Locations are Seattle, Bellevue and
Redmond.

When the user selects a location I would like the form to only display the
records with those locations. This is a Single Form not a datasheet view and
this is not a subform.

Thanks
Matt

-- 
Matt Campbell
mattc (at) saunatec [dot] com

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200712/1

0
mattc66
12/13/2007 12:59:57 AM
access.formscoding 7493 articles. 0 followers. Follow

11 Replies
444 Views

Similar Articles

[PageSpeed] 51

I would use the listbox onclick event for this.

Dim strSQL as String

strSQL = “Select coln,coln,…. From Table Where Location = ‘” & me.listbox &
“’”

Me.RecordSource = strSQL ‘update the form’s recordsource

I am assuming that the listbox Bound Column to 1 and the Field is “Location”.

If you want to reset back the form’s recordsource to the original SQL syntax,
use a button event as the above with some alteration to the variable “strSQL”
to match the original SQL string.

mattc66 wrote:
>Hi All,
>
>I have a form that is based on a query. I also have a unbound list box that
>the user can select a location from. The Locations are Seattle, Bellevue and
>Redmond.
>
>When the user selects a location I would like the form to only display the
>records with those locations. This is a Single Form not a datasheet view and
>this is not a subform.
>
>Thanks
>Matt
>

-- 
Please Rate the posting if helps you

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200712/1

0
AccessVandal
12/13/2007 1:39:58 AM
"AccessVandal via AccessMonster.com" <u18947@uwe> wrote in message 
news:7c9a344329afd@uwe...
>I would use the listbox onclick event for this.

PMFJI. Are you aware that the click event fires every time an arrow key is 
used to move the selection up and down a listbox? Imagine the flurry of 
network activity should you have just one user doing that..

Personally, I'd go for using the AfterUpdate event.


0
Stuart
12/13/2007 1:05:36 PM
What is "coIn" ?

AccessVandal wrote:
>I would use the listbox onclick event for this.
>
>Dim strSQL as String
>
>strSQL = “Select coln,coln,…. From Table Where Location = ‘” & me.listbox &
>“’”
>
>Me.RecordSource = strSQL ‘update the form’s recordsource
>
>I am assuming that the listbox Bound Column to 1 and the Field is “Location”.
>
>If you want to reset back the form’s recordsource to the original SQL syntax,
>use a button event as the above with some alteration to the variable “strSQL”
>to match the original SQL string.
>
>>Hi All,
>>
>[quoted text clipped - 8 lines]
>>Thanks
>>Matt
>

-- 
Matt Campbell
mattc (at) saunatec [dot] com

Message posted via http://www.accessmonster.com

0
mattc66
12/13/2007 4:47:17 PM
Here is my attempt at creating the SQL statement. It's not working. I get a
message that says I screwed up. I am missing something.

Private Sub txtLOC_AfterUpdate()

Dim strSQL As String

strSQL = "Select *, From qryInvData Where [LOC] = '" & Me.txtLOC & " '"

Me.RecordSource = strSQL

End Sub

AccessVandal wrote:
>I would use the listbox onclick event for this.
>
>Dim strSQL as String
>
>strSQL = “Select coln,coln,…. From Table Where Location = ‘” & me.listbox &
>“’”
>
>Me.RecordSource = strSQL ‘update the form’s recordsource
>
>I am assuming that the listbox Bound Column to 1 and the Field is “Location”.
>
>If you want to reset back the form’s recordsource to the original SQL syntax,
>use a button event as the above with some alteration to the variable “strSQL”
>to match the original SQL string.
>
>>Hi All,
>>
>[quoted text clipped - 8 lines]
>>Thanks
>>Matt
>

-- 
Matt Campbell
mattc (at) saunatec [dot] com

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200712/1

0
mattc66
12/13/2007 5:08:11 PM
Remove the comma before the "From". And you must make sure that the bound
column is the correct one.

mattc66 wrote:
>Here is my attempt at creating the SQL statement. It's not working. I get a
>message that says I screwed up. I am missing something.
>
>Private Sub txtLOC_AfterUpdate()
>
>Dim strSQL As String
>
>strSQL = "Select *, From qryInvData Where [LOC] = '" & Me.txtLOC & " '"
>
>Me.RecordSource = strSQL
>
>End Sub

-- 
Please Rate the posting if helps you

Message posted via http://www.accessmonster.com

0
AccessVandal
12/14/2007 12:46:41 AM
Coln as in "Select Field1, Feild2, Feild3 ..... From Table ...."

mattc66 wrote:
>What is "coIn" ?
>
>>I would use the listbox onclick event for this.

-- 
Please Rate the posting if helps you

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200712/1

0
AccessVandal
12/14/2007 12:49:12 AM
The listbox does not have a mouse over event. This condition applies if the
MultiSelect is set to "None". If you're using a ActiveX, yes.

Stuart McCall wrote:
>>I would use the listbox onclick event for this.
>
>PMFJI. Are you aware that the click event fires every time an arrow key is 
>used to move the selection up and down a listbox? Imagine the flurry of 
>network activity should you have just one user doing that..
>
>Personally, I'd go for using the AfterUpdate event.

-- 
Please Rate the posting if helps you

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200712/1

0
AccessVandal
12/14/2007 12:54:23 AM
"AccessVandal via AccessMonster.com" <u18947@uwe> wrote in message 
news:7ca6614e484db@uwe...
> The listbox does not have a mouse over event. This condition applies if 
> the
> MultiSelect is set to "None". If you're using a ActiveX, yes.
>
> Stuart McCall wrote:
>>>I would use the listbox onclick event for this.
>>
>>PMFJI. Are you aware that the click event fires every time an arrow key is
>>used to move the selection up and down a listbox? Imagine the flurry of
>>network activity should you have just one user doing that..
>>
>>Personally, I'd go for using the AfterUpdate event.

Look again. I didn't mention a mouseover event. Far from it.


0
Stuart
12/14/2007 1:18:57 AM
If you mean the keyboard Up/Down arrow keys, it’s not going to make any
difference. 

But which developer uses a very large data to display a lookup?

If you have a very large data as a lookup, why use the back-end when you can
put it into the front-end?

Then again, why use combobox or listbox for a huge list of data?

Stuart McCall wrote:
>>>Personally, I'd go for using the AfterUpdate event.
>
>Look again. I didn't mention a mouseover event. Far from it.

-- 
Please Rate the posting if helps you

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200712/1

0
AccessVandal
12/14/2007 2:55:16 AM
"AccessVandal via AccessMonster.com" <u18947@uwe> wrote in message
news:7ca76f2abe381@uwe...
> If you mean the keyboard Up/Down arrow keys, it�s not going to make any
> difference.
>
> But which developer uses a very large data to display a lookup?
>
> If you have a very large data as a lookup, why use the back-end when you
> can
> put it into the front-end?
>
> Then again, why use combobox or listbox for a huge list of data?
>
> Stuart McCall wrote:
>>>>Personally, I'd go for using the AfterUpdate event.
>>
>>Look again. I didn't mention a mouseover event. Far from it.

I never mentioned 'huge lists of data' either. I also never mentioned 'using 
the back-end' (whatever you mean by that). You seem to enjoy putting words 
in my mouth.

My point is simply that, by using the click event you are causing Access to
do unnecessary work.

However, do whatever you feel is right. I couldn't care less now <sigh>.


0
Stuart
12/14/2007 3:59:19 AM
Oh great! Now I'm label as a bad guy. Mr Sensitive, I never put any of that
into your mouth. That's your own personal assumption and insinuation. Look
again and reflect on what you had posted.

Stuart McCall wrote:
>I never mentioned 'huge lists of data' either. I also never mentioned 'using 
>the back-end' (whatever you mean by that). You seem to enjoy putting words 
>in my mouth.
>
>My point is simply that, by using the click event you are causing Access to
>do unnecessary work.
>
>However, do whatever you feel is right. I couldn't care less now <sigh>.

-- 
Please Rate the posting if helps you

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200712/1

0
AccessVandal
12/17/2007 2:06:27 AM
Reply:

Similar Artilces:

Filters *SOS* Filters *SOS* Filters *SOS*
1) On formLoad, I need to show only those items which are unassigned. 2) I need for the end-under to select only the items they are assigned to. 3) I need an option to select "ALL" so I can view all items. Any insight offered would be appreciated!!! On Wed, 29 Aug 2007 16:24:01 -0700, valdaiway <valdaiway@discussions.microsoft.com> wrote: >1) On formLoad, I need to show only those items which are unassigned. Use a query to put a criterion on the field that defines the assigned status. I assume you know how that information is stored in your table; nobody here does, ...

SQL 2005 Data Encryption
We are upgrading our DB Server to SQL 2005 next year and want to take advantage of Database Encryption for sensitive data in GP such and SSN and Banking Accounts. Has anyone attempted this? Not sure where to start. On Dec 9, 5:18=A0pm, Amanda <Ama...@discussions.microsoft.com> wrote: > We are upgrading our DB Server to SQL 2005 next year and want to take > advantage of Database Encryption for sensitive data in GP such and SSN an= d > Banking Accounts. > > Has anyone attempted this? =A0Not sure where to start. This will not work with GP because you have to encrypt on...

can you update a charts data range automatically in Excel?
In a spreadsheet with multiple charts, is it possible to update the data range and supporting calculations for the charts when you paste new data into the spreadsheet. Calvin If your question is, can you change the data to update the charts, Yes. If not please clarify the question Thanks Vyenktesh "Cal@tech-etch" wrote: > In a spreadsheet with multiple charts, is it possible to update the data > range and supporting calculations for the charts when you paste new data into > the spreadsheet. > > Calvin Calvin - You can set up the charts to use dynamic range...

Criteria for Advanced Filter HELP
I have what I think is a simple question that I need answered IMMEDIATELY. I have a spreadsheet with 20 fields and I want to filter it so it only shows records that have something in of any of 5 of those fields. So once filtered, I will not have any records that have all 5 of those fields blank. I know I have done this before but I'll be damned if I can remember or find out how. -- Thanks You all are teaching me so much don't cross-post -- answer supplied in misc NG "knowshowrosegrows" <knowshowrosegrows@discussions.microsoft.com> wrote in message news:ACBC0...

Employee Filters
Hello: On the employee filters in the HR Preferenes window, would this restrict seeing employee information in both Payroll and HR? Also, would it restrict reporting on certain employees in a division or department? Thanks! childofthe1980s Your message does not indicate which version of Great Plains you are using. Using 8.0 with SP3 applied, HR filters do apply to some of employee information outside of HR. The settings will filter selected forms, Smartlists and Lists items. The HR filter setting do not apply to reports outside of HR. The filtered forms are: Employee Maintenance,...

Image in Knowledge base
Hi, Is it possible to add an image in an article of the knowledge base? Thanks for your help I don't think this is possible. But, it is pretty easy to drop in a hyperlink to a picture on another server, or a local file, etc. When you publish the article, the hyperlink becomes active and will open another window with the picture. Not that great, but it does work. Good luck! Steve C. "B. Guillout" wrote: > Hi, > Is it possible to add an image in an article of the knowledge base? > Thanks for your help ...

Hyperlink base: What does it do?
Excel 2007 I've been reading some posts on the hyperlink base feature, but I'm not sure what it's supposed to do. What I would THINK it should is that, when you press Ctrl-k in a cell, the Address would automatically appear as your base and the Current Folder would open to the base folder, so you could set you more- specific hyperlinked location from there. But that's not what happens. Does the hyperlink base have any practical value when creating hyperlinks using Ctrl-k? Thanks. ...

Filtering based on a filter
Hello, I have an Excel Worksheet with a Pivot Table at the top with a Filter and a data set returned from a DB2 database below it. I would like to filter the DB2 data set based on the Pivot Table filter that is enabled. Any ideas? Thanks! James, You can't filter two ranges on the same worksheet. You can, instead, drill-down on your pivot table, which will show all items that go into the value on a newly created separate sheet. The drawback to that is that you cna only drill down on one item at a time, and it is a separate sheet. HTH, Bernie MS Excel MVP "James" <an...

comparing data
I have an old A2k db I am trying to normalize, and there are many instances where the same company has been entered multiple times, but typed differently enough to allow the multpile entries (like "Company"; "The Company"; "The Company Inc" etc.). Is there a function that would allow me to compare text data entries that are similar to one another so I can reconcile them into one entry? Kinda like a Find Dups query but obviously these aren't exact dups... TIA -- Any help is greatly appreciated :) There really isn't any easy way of doing what you&...

Question on the IMF filtering in exchange...
Hey I installed the IMF filter last night and it works great, with one exception. I set both thresholds to the same (5) and got almost all blocked emails into the archive that were junk...So that is good. However I had some users report that there was mail in their junk folder that should have been good Inbox mail. This I undersyand and can live with as folas-positives...the problem is, since both settings on the folter tab were set to 5, how does it know to send the mail to archive rather than Junk folder? Why wouldn't it just send them all to archive if both settings were at ...

Access 2007 Run-time Error 2467 when accessing a listbox value on a sub form
I have a database that has been in production on Access 2003 for quite some time and has run without errors. A user's machine was recently upgraded to Access 2007 and now the database throughs a Run-time Error 2467 "The Expression you entered referes to an object that is closed or does not exist" on the following line that references a listbox value on a sub form. If Nz(Me.sfrm_Consultant_Contract_Request.Form.Cmb_Consultant.Value) = "" Then .. .. .. I changed the code to If Nz(Forms! frm_Main.sfrm_Consultant_Contract_Request.Form.Cmb_Consultant.Value) = ""...

Filtering without Filter
I just don't get the following. Any ideas? "A" row I have two different values I use: "Contact" and "Not a contact". "B" row I have the person's name (employee). "C" row I have a quantity, just one number. Now what I need is to output quantities of how many Contacts Employee1 or Employee2 or Employee3 have. Also what I need is to get the number of contacts - which can be found on row "C". Should I use COUNT.IF ? Row A can have 2 or more different values so should there be somekind of conditional IF function included? T...

Combine columns of data into one
Hi, I want to combine columns of data into one, e.g. to combine column 1, 2 and 3 into column 4 column 1 column 2 column 3 column 4 1 a i 1 2 b ii a 3 c iii i 4 d iv 2 5 e v b 6 f vi ii 7 g vii 3 .... Thanks in advance. I should put the message under other catergory. Sorry about that. In your empyt co...

Filtering #11
Hi, can ayone tell me how I could do the following in excel 2007 or 2010: Horse Trainer Sam M Jones John M Jones Colin S Attwater Steve J Jackson Brian B Mathers James B Mathers Martin G Raggy Patrick S Thomson What I want to do is filter the dataset on 'Trainer' so that it only shows me the Trainers who feature once in the list. So if I was to do this properly it would only show S Attwater and G Raggy as the other trainers have more than one horse..... Hopefully someone can help because it is driving me crazy !! Thanks David Give this macro a try... Sub HideDuplicateTr...

Junk filter BEFORE other filters?
I am running Outlook 2003 and the Junk filter was working really well. Then I started making other filters...one of them looks for my domain name in the headers and if it's there it moves the email to a folder. Problem is, this filter seems to activate before the junk filter, so the junk sn't being filtered now! How can I set the junk filter to do it's job first and THEN to run my own rules? -- Bryan Anderson <www.anderson-it.com> I created this rule and set it as the first rule to run: Apply this rule after the message arrives with 'X-Spam-Level:******'or'...

Pasting into a filtered list
Can anyone tell me if it is possible to paste a list of price updates into a filtered list. - I have filtered the list to show just the products whose prices need to be updated, when I try to paste the updated prices, into the list, the prices are not just pasted into the visible cells but the hidden cells between. Can I paste into the visible cells only or do I have to update each line manually. I am using Excel 2002 Any help would be much appreciated Can you sort the list to bring the products that need updating together in the list? If not, try something like this: Your list of product...

Forumula to Extract Data
I have an Excel spreadsheet with contact information I want to import to a CRM lead system. Current Excel sheet format is all in one column going down as follows: Company Name, Address, City State Zip (all one field), Phone number, then empy cell then repeat of 4 cells listed above. Want to convert to a new .csv file with listing going left to right on on line as follows (ending up with 6 column fields - 1. Company Name 2. Address 3. City 4. State 5. Zip 6. Phone Any suggestions on how to accomplish this? Thanks. Kip The hard part will be parsing the column with City State Zip into thre...

Newbie Help with form
Hi, I am looking to have a form, where when I select one field in a combo box, it automatically updates all the other fields to match that list so for example.. I have a table with 3 fields telephone first name last name So I want a drop down box on the form, and when I choose the telephone number i want, it automatically shows the first and last name with it... Additionally I would want to be able to choose a last name, and it show the telephone and first name associated Access 2003 Thanks in advance On Wed, 13 Feb 2008 13:50:33 -0800 (PST), potentus <neopotent@gmail.com> wr...

Macro to copy a VLOOKUP formula
Hello, I was wondering if somebody could help me with this macro… I have some data with a filter on, so that only the rows with blank cells are showing. I want to enter a VLOOKUP in the cell, and copy it down to all the blank cells. I tried just recording a macro, but when I run the macro it doesn’t work. Any ideas of how to do it? Example: 1) Before the filter: Colums A -B - C A x x - 1st Row A - 2nd Row A x x - 3rd Row A - 4th row A x x - 5th row 2) After the fil...

apply filter macro
I have a access db that works on win xp but does not work on win 2007 I have a combo box that triggers a apply filter macro using a query sort. no problem on win 2000 or win xp or win 2003 Help AlT ...

Sorting Data by Priority
I am setting up a excel databse that will track computer problems. On sheet 1 I have a User Input Sheet where the user can input their name, the date, description and priority of problem (priority eg: 1: Urgent, 2: can wait for a few days, 4: Nuisance and fixed sometime). I have a process macro on sheet 1 which transfers all the user's inputted data into Sheet Two. I want to sort sheet 2 by the Priority of the problems. Is there any way I can do this without having to select the sheet and having to go to data and Sort? I have sheet 2 linked to Access. Any help with this would be really ap...

IP filtering based on corresponding MX records
Hello Dears, How can I implement the following? Used: Exchange 2003 SP2 in FE/BE configuration; FE is in perimeter zone (capable to “speak” with DNS, BE, DCs and retrieve info) So, somebody connects my FE to sent an e-mail to one of domain users. I need something like that: When connecting, see the “mail from: user@somedomain.xxx”; Verify if there is a record MX for the IP address from which the connection was established in DNS for the domain “somedomain.xxx” If not – drop connection (attention: MX record, not SPF) Is it possible with Exchange 2003 SP2 only? How? Thank you, Alex I be...

Month Filter
I keep a log of checks that I receive in my department throughout the year. I have the checks listed by date (mm/dd/yy), payee, check #, etc. What I want to do is be able to filter the list by month (ex., March 2005). Is there a way to do this? Thanks Joseph You can Try EasyFilter Joseph http://www.rondebruin.nl/easyfilter.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Joseph" <joe@nospam.com> wrote in message news:%23lQNnTawFHA.464@TK2MSFTNGP15.phx.gbl... >I keep a log of checks that I receive in my department throughout the year. I have the checks lis...

Error writing OLE data
I inserted some JPG pictures. Now I can't save my file. I get : "An error (1441) occurred during the action Save. There was an error reading or writing OLE data." Now what?? I'm using Visio 2003 SP2. Barry Hi Barry, Can't reproduce the issue but clearly some or all pictures are containing an corruption Some suggestions: try to save the .jpg picture one by one to determine if one of the pictures is the culprit try inserting in another format format such as .bmp, .png, .gif etc try other office applications, if you don't experience a problem then copy&...

Pasting Data into a webpage text box
Simon move my posting at the codecage from excel to word so i'm reposting at MS so it appears where I wanted the posting. I'm working om a Webpage project where I'm copying from a word document to a webpage with a box similar to the message box I'm presently typing in. The webpage doesn't allow modifying the innertext or innerHTML. I saved the word document to HTM file format. I then open the html file as a text file and perform a readall. Then simply move it to the outter html IE.myobject.outterhtml = fs.readall This destroys the box and just displays th...