I have two combo boxes, Company Name & Name. The data that is selected is used to run a query from a button. However i would like to set it that if the user (but not required) selects the company name then only the names of the people belonging to that company appear, but if no company is selected then all the names for every company appear.
Can anyone make a suggestion as to the best way to go about this.
I have seen a few articles here and there on using a combo box to filter records in a sub-form and to filter records in another combo box, but I am not getting anywhere. I hope someone can belp
Exercise 1
For this exercise, I have the following tables:
tblClients containing client names tblProjects containing some project details
I want to set up a simple form, so that the user can select a client name from a combo box on the main form which filters the project detail records in the Projects sub-form. Once the user enters project details, I want this info as well as the selected ClientID to be fed back to tblProjects.
Exercise 2
I have the following tables:
tblProjects as above tblWorkstream containiig names of workstreams and some other details.
Every project has one or more workstreams
I have a form where users will enter hours worked on each workstream. They will first select Project from a combo box on the main form. This should then filter records to be displayed in the Workstream Combo box, before they can then enter hours.
Please let me know if you need me to explain any part of this better.
Thanks in advance.
ps. I am a novice, so I'm hoping to do the above using default MS stuff, not with complex programming!!!
I'm having a little difficulty setting up a combo box to filter another combo box. I've actually got one working but the second one is giving me all sorts of errors. On the attached database, there's a form called frmAddNewRecord. At the top of the form there's a combo box which allows you to select a name and another combo box beside it which acts as a filter so only names from a certain section are shown (working fine).
The subform which is attached to this form and contains the training details, has another combo box which allows you to select a job...I've tried to add a combo box beside this to filter it but I can't get it to work.
Hi All, Just after a code or way to filter client details via a combo box. Basically select combox drop down menu select the sales rep then it filters by sales rep and shows only the clients for that sales rep. I can get it to filter but it does the first client of that sales rep but not the rest.
I've read several threads about one combo filtering a second combo on a form, but can't seem to find a similar enough situation. Can you please advise on the following:
I have a form based on a query containing a whole load of fields from several tables. In particular the query contains a field called WorkstreamID from tblWorkstream.
Each tblWorkstream record has a Workstream ID, Workstream and foreign key called Project ID from tblProjects.
I want my form to have two combos: one for Projects (unbound) which filters the combo for Workstream (bound to the underlying query of the form)
I have a form with a list box that is filtered by the entry made into a combo box. It works fine except that I want an option which shows all records in the list box. I tried using the formula below in the query criteria for the list box but it returns no records when I select All in the combo box. Why won't it work? Is there a better way to do this? Can anyone help?
hi all, another quick question (last one for awhile I promise) but is there a way to add an option to a combo box (Filter by Selection) and Remove/Filter sort without right clicking on it? cheers, Andrew
I have a table that has the fields Scheme no, Title, Area, Pole No, Rate No, Description, Quantity. Each Scheme No has a number of Poles attached to it, and subsequently each Pole has a number of different rates attached (eg of table shown below)
On the corresponding form I have ID No, Title and Area in the Form header as they are the same for all fields. Therefore in the detail section I want the rest of the fields. The problem I have is I want the user to be able to choose a pole no from a combo box and show up only the corresponding rates to that pole. So for instance below the user could select in the combo box Pole no YP08 and only the rates used on that pole would show up (in this case it would be just HV99 and its description).
Hi There. Im Trying To Filter Records Through A Combo Box Which Is So Far So Good. However What I Would Like To Do Is Select The Records Through The Combo Box And Have It Return And Populate Only Those Records. Has Anyone Got Any Suggestions To This? Ive Attached The Sample Database Im Working On.
I am having an issue with my combo box filter, this set of code dynamically updates the combo box to add any new user and select the accounts that are assigned to them. Given everything works and everything filters, the problem is merely a cosmetic one that has to be fixed.
Basically what is happening is the Combo Box displays "*", and "All Records" but we can not get it too show the "Unassigned" -- any idea why?....
I have a problem. I want to apply a filter on my form.When I filter on the combobox it works fine. But when I filter on the date the form jumps into the error handler. Below is the code that I use for my filter:
Sub ApplyFilter() Dim sFilter As String sFilter = ""
'Filter on date If Me.txtFilterDatumMelding = "" Or IsNull(Me.txtFilterDatumMelding) Or Me.txtFilterDatumMelding = 0 Then If sFilter = "" Then sFilter = "" Else sFilter = sFilter & "" End If Else If sFilter = "" Then sFilter = "[DatumMelding] = " & "'" & txtFilterDatumMelding & "'"
Else sFilter = sFilter & " and [DatumMelding] = " & "'" & txtFilterDatumMelding & "'" End If End If
'Filter on combobox If Me.cboFilterCallMelder = "" Or IsNull(Me.cboFilterCallMelder) Or Me.cboFilterCallMelder = 0 Then If sFilter = "" Then sFilter = "" Else sFilter = sFilter & "" End If Else If sFilter = "" Then sFilter = "[CallMelder_ID] = " & cboFilterCallMelder Else sFilter = sFilter & " And [CallMelder_ID] = " & cboFilterCallMelder End If End If
If Len(sFilter) > 0 Then Me.Filter = sFilter Me.FilterOn = True Else Me.Filter = "" Me.FilterOn = False End If End Sub
I hope that you gus can help me. Could it be that the filter is a string and the date filter field is a date??????
I have at present 2 combo box's that filter, now....... the 1st combo box is a drop down value list that will filter the OPOwner (persons name) for example there are 3000 records and 5 OPOwners, I can for now filter my name in cboOPOwner combo box.
The 2nd box (drop down list) is Status which would be "New";"Open";Pipeline";"Lead" ect...
If I filter my name it brings up all records related to my name and the when I want to filter status it will bring up all records relating to say 'Pipeline' however it will bring everyone's ;Pipeline and not just mine.
What I want is to filter my name in the OPOwner combo box and once all records are filtered in my name then in the status combo box filter what ever I want to look at. example what I want to filter - 'Filter Neil' then 'Filter Pipeline, or filter Lead or New'.
This is the code I have in both combo's....
Private Sub cboOPOwner_AfterUpdate() If Nz(Me.cboOPOwner.Text) = "" Then Me.Form.Filter = "" Me.FilterOn = False ElseIf Me.cboOPOwner.ListIndex <> -1 Then Me.Form.Filter = "[OPOwner] = '" & _ Replace(Me.cboOPOwner.Text, "'", "''") & "'" Me.FilterOn = True
I am trying to edit the below code to use 'Form_Select_Batch_Number_Form.Combo9.Value' as the combobox value to filter the records in 'Form_ Remitter_DB_Entry_Form'. I am trying to get the filtering to occur when a button on Form_Select_Batch_Number is selected. Below is my attempt to create the button to accomplish this but it is not functional and needs some work.
Code:
Option Compare Database Private Sub Command0_Click() DoCmd.OpenForm "Blank Form2", windowmode:=acDialog Dim MyValue As String
I am back with another question about Access 2010. I would like to filter a table by using a combo box.
I have several columns in the table, and I would like to filter them by their departments (there are several users in each department)
I have tried using the combo box wizard and select " I would like to search records based on the values in combo box" but the problem is that the department shows up as many times as it is in that table.
I came across another solution which was to create an unbound combo box and link it with the query. and the department criteria would be the following:
I`m using access 2010 version, i have one table(Customer) which has one-to-many relationship to the table(Order), so the Order table contains many records from one single record in Customer. How to create a combobox that filter and show how many orders the Customer has. Example:
Table(Customer) Line 1 - Crystal
Table(Order) Line 1 - Water Line 2 - Cookies Line 3 - Pens
Okay I created a database that I am going to use to collect data about a study we are doing.When a participant is added to the database on the main (Participation Details form), it automatically generates an ID and creates a record in a second table/form - a questionnaire (i.e. Athens Questionnaire) that the participants fill out preserving the ID number that was created in the participation details form (I have been able to achieve this).However what I wanted to do next is be able to filter the Athens questionnaire using a combo box which contained all the participant's ID's.I was able to create the combo-box and populate it with the ID's using a query and did not put a control source on it (i used =tblAthens.ParticipantID ....) iand created a sub-form that contained the questionnaire. I did this by creating the questionnaire in a separate form called frmAthens_sub and dragging it from the "explorer window" into my open Athens Questionnaire form. However when I attempted to place code in the "After Update" field of the combo box I keep getting errors and I am not sure why.The code I am using is:Option Compare DatabaseSub SetFilter() Dim LSQL As String LSQL = "select * from tblAthens" LSQL = LSQL & " where ParticipantID = '" & cboSelected & "'" Form_frmAthens_sub.RecordSource = LSQL End SubPrivate Sub cboSelected_AfterUpdate() 'Call subroutine to set filter based on selected ParticipantID SetFilter End SubPrivate Sub Form_Open(Cancel As Integer) 'Call subroutine to set filter based on selected ParticipantID SetFilter End SubIt is highly possible that I am just not doing something right as this is the first time I have used sub-forms. I tried to attach a copy of the database but cant get it below the max. The error seems to be coming from this line --> Form_frmAthens_sub.RecordSource = LSQLIs there an easier way or alternative code for filtering a sub-form from a combo-box?
I am pretty new at this so please bear with me :confused: (like that isn't said a thousand times!). I am creating a small database to track task data (manpower tracking basically) where I have the following fields:
Customer Functional Group Task Status Task Name Task Description WO # Funded Hours Notes
I would like to create a combo box where the user can select the customer (I have 124 records in total, 15 unique customer names) and all tasks relating to that customer are filtered directly in the Form by clicking a single button to do the filter.
I don't want to create dozens of tables and forms to flip through and such (users need it as simple as possible). I have created queries but the only way I have successfully filtered each customer is via buttons...but 15 buttons to filter each individual customer is a pain in the butt, so any help would be REALLY appreciated.
Please let me know if I haven't explained this clearly enough! :)
Hello, This is my first time posting here and I hope someone can help me. I am not experienced with coding in access and only recently started using forms.
I am trying to create a text box that automaticly fills in once a selection is made in a combo box.
There are only 2 tables and 1 form I am working with. Table 1 has columns "code" and "bu". The second table has several columns, all blank, that the form fills in.
The combo box is working correctly, it displays all the "code"s. Once the code is selected I would like a text box to display the "bu" column.
TblCat Contains fields CatID (index) & CatText (Text) TblType Contains field TypeID (index) , CatID (index) , and TypeText (Text) Relationship of tbleCat.CatID (one) to tblType.CatID (many)
Forms!Input!cboCat bound to Tables!Inventory!Category Forms!Input!cboType bound to Tables!Inventory!Type
Intent: Choice from cboCat to provide from list for entry into Inventory.Catagory plus filter list choices for cboType for entry into Inventory.Type.
cboCat : RowSource : SELECT [tblCat].[CatText], [tblCat].[CatID] FROM tblCat; Event: Private Sub cboCat_AfterUpdate() Dim xxx As String
xxx = "SELECT [tblType].[TypeID], [tblType].[CatID], [tblType].[TypeText] " & _ "FROM tblType " & _ "WHERE [CatID] = " & Me.cboCat.Value Me.cboType.RowSource = xxx Me.cboType.Requery End Sub cboType: No special RowSource or events
cboCat works fine but cboType has a popup box that asks for the Parameter value for the choice made in cboCat. ( Me.cboCat.Value ???) Where did I go wrong ??
In Dec 2013 I created an Access table "Donations" that contains fields regarding charitable donations (Date, Donor, Amount). I use an Access form "Select Donor Form" to select a specific Donor (via combo box) from the table. Then an Access Query "Select Donor Query" uses the Donor selected from the combo box in the form to display all of the donations from that Donor for the year as an Access report.
Since I just created this Access table last month, it only had data from 2013. Now that we are in 2014, in preparation for when I run this report next December, I obviously need to modify "something" to clarify that I want the donations from a specified Donor for a particular year (i.e 2014, 2015, 2016, etc.).
I added a field to the Access table called "Year". I probably can derive the year from the already present "Date" field, but sadly, I don't know how to do that. I want to simply edit the existing combobox in the existing form to return Donors that have a record in the existing table where the Year = 2014. That way, the only changes I will need to make over time is to update which year I need and all of the Donors for that year will populate in the combo box.
Below is the Access macro belonging to the combo box in the form. I converted the macro to Visual Basic. What to add to select the Donor for a particular year. You can see that right now it is only selecting "Donor Name" without regard to which year the donor has a record.
I have some code in which I enter a startdate and a enddate into textbox's and a combo box where I enter a client name when I run the code it will show all record's generated with in the date range and same client name set in the combo box "cboclient" what I would like to be able to do is have another combo box call cboclient2 which will allow me to enter another client name so then when the report opens it will show me with in the date range set in startdate and enddate and filter the client field by cboclient and cboclient2 so for e.g.
startdate 01/01/14
enddate 11/01/14
cboclient peter
cboclient2 steve
Run code show all record in date range and with client name peter and steve
Here's the code I have
Private Sub cmdPreview_Click() 'On Error GoTo Err_Handler 'Remove the single quote from start of this line once you have it working. Dim strReport As String Dim strDateField As String Dim strWhere As String Dim lngView As Long Const strcJetDate = "#mm/dd/yyyy#" 'Do NOT change it to match your local settings.