Filtering Query For Combobox In Subform
Jun 21, 2005
I have this form where there's mention of CompanyID
In a subform, I have the information about all the contacts of this Company. In order to see full detail information for a particular contact (of that particular Company) I have a Combobox with a query.
At least: that's the whole idea. Unfortunately it doesn't work in Access:
SELECT Contact.ContactID, Contact.Name
FROM Contact
WHERE ((Contact.CompanyID)=(Me!frmCompany![ContactID]));
Can any help me? I need to do more of the sorts of queries... and I can't figure it out how to use values from forms and parent-forms.
Any help is appreciated,
Jazz
View Replies
ADVERTISEMENT
Jan 26, 2005
Hi folks, I have a question regarding filtering of a data in a listbox.
Basically the listbox has rows of data from a main table, with 8 columns, i.e. 8 data fields (CustomerID, Product, Subject, Date etc.). At the moment the list box shows all data entries, I then want to filter out certain entries. For example, only show entries with a certain Product. In the main table the Product field is filled by selecting a product from a combo box. I want to filter my listbox using a combobox containing these products. I have the listbox and combobox set up on a form. Is it possible to filter in this way or should I construct an Option Group and filter using that?
Many thanks,
Debs
View 1 Replies
View Related
Nov 9, 2006
Hi
I have a minor problem.
I have a table and form with a carpool.
I would like to be able to display history by date with the help of the combobox which car you had last week.
But I don't know how to go about it.
I have attached a DB and would be glad if someone can but their magic touch to it.
Mikael
View 3 Replies
View Related
Jan 2, 2014
I'll start with explaining what my goal is.. I have a table with workorders, it has a column "date planned" so I can give all the work orders a date when to be executed.
On the other hand I also have a table with the ID of every technician and the dates when their vacation starts and ends, so 3 columns, 1 text, 2 dates.
To link the 2 I use a table "schedule" where I have 4 columns, "ID", "WO", "TechID". WO refers to the workorder nummer that can be found in the schedule table.
My end goal is to have a form with a subform "schedule" where I can see all the workorders in dataview, when I select a workorder in the table I want to fill up a combobox with all the technicians available, so that means that all the ones on vacation on the planned date of that WO are not included in the combobox..
I tried making a select query, but I have no clue how to make a "select ... where (date) is not between ... and ..."
View 4 Replies
View Related
Jun 23, 2015
I'm trying to filter the listbox using a combo box.
So I have a Combo box that has the list of the subjects and a listbox with the list of students.
I wanted to show the list of students who are registered in selected subject.
View 3 Replies
View Related
Nov 12, 2014
My database is centered on a main form where users select pieces of information from ComboBoxes (primarily) and submit.
The first part of the form, they must choose from a list of our clients, which is a table with with roughly 5000 rows.
Later on in the form, they must choose a contact person from that client. While Client's may have several contact names (which need to be stored in a table), only one name is necessary for the form portion.
How can I make this Contact Person ComboBox only load names attached to the specific Client selected above?
As it stands right now, the Client List has its own table (along with additional information), and Contact Name is a separate Table with a look up field of Client List.
View 1 Replies
View Related
Apr 4, 2013
Ok I have a list box (CounselorInitials) and a listbox (AssignedToYou)
The list box has 6 columns and is using a query (AssignedToMe). The important one is the 6th one (Counselor). All working off a table called DityLog.
I want to select initials in the combo box and then it will filter the listbox and only show records that are the same.
So if I select initials MC from the combo box I want the Listbox to show all records that have the initals with MC.
View 1 Replies
View Related
Sep 1, 2006
I almost have this form done.
I have a form with a combo box, and 2 subforms from it. When you select in the combo box (Group), it brings up the choices (Sections) for that group in a subform. Then there is another subform, that is supposed to bring up a series of questions that are related to the section that has been selected. The question field has a drop down to a list table, that has all the questions. Once the question has been selected, it stores in a Master table. The relationship is there. If you try to select any questions that do not pertain to the section, it gives you an error message.
What I need it to do, is when the section is selected, filter out the questions that pertain to that section, and have those questions be the only ones available in the drop-down list to choose.
I know that I need to have an After Update code once the section has been selected, but not sure how the coding should be.
I hope that someone can help with this!
:confused:
View 1 Replies
View Related
Sep 1, 2006
I have a form that is almost complete
I have a form with a combo box, and 2 subforms from it. When you select in the combo box (Group), it brings up the choices (Sections) for that group in a subform. Then there is another subform, that is supposed to bring up a series of questions that are related to the section that has been selected. The question field has a drop down to a list table, that has all the questions. Once the question has been selected, it stores in a Master table. The relationship is there. If you try to select any questions that do not pertain to the section, it gives you an error message.
What I need it to do, is when the section is selected, filter out the questions that pertain to that section, and have those questions be the only ones available in the drop-down list to choose.
I know that I need to have an After Update code once the section has been selected, but not sure how the coding should be.
I hope that someone can help with this!
View 1 Replies
View Related
Jun 6, 2013
There is a command button on my form that calls a filtered query. I'm filtering the query based on a combo box within the form using
[Forms]![frmAssignDwgs]![Combo15]
It works beautifully until I put the form as a subform in the Navigation Form I'm using. When I execute it from within the Navigation form, it errors out looking for [Forms]![frmAssignDwgs]![Combo15].
Is there another syntax I can use so this will still work from within the Navigation Form? Or another way to approach this functionality?
frmNavigation is the main navigation form
frmAssignDwgToPkgs is the subform that holds Combo15
I found another thread (which I can't link to since I'm new) and tried various arrangements of the following to no avail.
[Forms]![frmNavigation]![NavigationSubform] .[Forms]![frmAssignDwgToPkgs]![Combo15]
View 3 Replies
View Related
Nov 22, 2006
I have an SQL query that filters a subform based on the selected item in an option frame that runs on the after update event of the option frame.
Forms!fsubPrjPersonnel.RecordSource = SQLText & WClauseWhen I try this out, I get the following error message:
2450 - xxx can't find the form 'fsubPrjPersonnel' referred to in a macro expressions or Visual Basic code.
I then ran the following snippet and found that the form is not recognized as being loaded when it is "open" as a subform
If IsLoaded("fsubPrjPersonnel") Then
MsgBox "form found"
End If
If I open the subform as a form as well as having the main form & subform open, i.e. open a second instance of the subform from the database window, it filters fine.
I have been able to requery the subform so where am I going wrong?:confused:
View 5 Replies
View Related
Mar 31, 2005
I have a sub form to which I want to apply filter buttons.
I have used the wizard to set these up.
The problem I have is that when I try to filter the SubForm the MainForm also filters.
The forms are based on tables and not queries.
Cheers
Gordon
View 1 Replies
View Related
Mar 6, 2006
Yes, Ive searched the forum and Im still stuck on this most basic of concepts - please can someone point me in the right direction?..
I have a Form [frmClient] and a subform [sbfrmCommsList]. The subform links nicely with the main form via [ID]. However I want to add a second filter on the subform selecting only [Type] = 2 rows (from the child table)
This is in the subform:
Private Sub Form_Load()
Me.Form.Filter = "Client=" & Me.Client & " AND Type =2"
Me.Form.FilterOn = True
Me.Form.Requery
End Sub
It still displays all records (Both [Type] 1 and 2)...
thanks..
View 2 Replies
View Related
Sep 13, 2006
i have a form with a subform on it. the subform has 2 columns - one of which is hidden. Assume the other column is called "type".
i was wondering if there is an easy way to 'hide' records in the subform which have "type" = "Car"
thanks
View 3 Replies
View Related
Aug 1, 2005
ok, i've discovered filtering does not work on subforms so i have searched the forum and modified some code to this:
Dim strSQL As String
strSQL = "Select * from tasks where"
strSQL = strSQL & Me!frmSubProjects.Form!Project = 2
Me!frmSubProjects.Form.RecordSource = strSQL
error message is " can't find the field 'frmSubProjects' referred to in your expression. (line3)
Please note a 'mouse over' of Me!frmSubProjects.Form!Project in the above code does show a result (first 'Project' value in subform) - so what am i doing wrong??
thanks in advance,
Paul
View 3 Replies
View Related
Aug 23, 2005
I have a tbl_product with PK_productID as primary key and frm_search with a subForm in it, How do I filter my subForm in a form with a single click button?? well... at first i did it with open new form with a specific data to display.
and from now on i want with a single click in my search form the result will show up in my subform but i don't know how to do it T_T
anyone can help me with this problem??
thnx...
View 1 Replies
View Related
Jan 8, 2006
I've finally figured out how to populate my list box with radio buttons (3 companys listed on the radio buttons, you click one and employees for that particular company populates the list box). Now I'm trying to figure out how to click on an employee in that box and have their contact information populate the subform that holds that info.
After trying unsuccesfully with VB, I considered using a macro that would open the subform where the Last Name = the Last Name clicked in the list box, but I couldn't figure that out (couldn't figure out what the name would be for the selection in the list box) but I would prefer the subform be there permanantly in "add" mode untill a selection is made in the list box.
I'm code ignorant and rely on google and what books I have for reference / copy-past.....any ideas?
View 3 Replies
View Related
Jan 8, 2006
I've finally figured out how to populate my list box with radio buttons (3 companys listed on the radio buttons, you click one and employees for that particular company populates the list box). Now I'm trying to figure out how to click on an employee in that box and have their contact information populate the subform that holds that info.
After trying unsuccesfully with VB, I considered using a macro that would open the subform where the Last Name = the Last Name clicked in the list box, but I couldn't figure that out (couldn't figure out what the name would be for the selection in the list box) but I would prefer the subform be there permanantly in "add" mode untill a selection is made in the list box.
I'm code ignorant and rely on google and what books I have for reference / copy-past.....any ideas?
View 1 Replies
View Related
Sep 12, 2006
Hi all
I have been using some code from this site to filter my forms and subforms via a selection of combo boxes. However, when I try to filter by either date or callid, I get runtime error 2001 and the debugger drops in at the first forms!filter line. This seems to work perfectly well for the other 3 combos that I use. Is it to do with the type of fields I am trying to filter with or am I missing something integral to the code? Each combo is named Filter1, Filter2, etc and the name of the field to filter by is placed in the tag line for the corresponding combo box.
Private Sub Command13_Click()
Dim strSQL As String, intCounter As Integer
' Build SQL String.
For intCounter = 1 To 5
If Me("Filter" & intCounter) <> "" Then
strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] " _
& " = " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & _
" And "
End If
Next
If strSQL <> "" Then
' Strip Last " And ".
strSQL = Left(strSQL, (Len(strSQL) - 5))
' Set the Filter property.
forms!frmoutershell.frminnershell.Form.frminnerinn ershell.Form.Filter = strSQL
forms!frmoutershell.frminnershell.Form.frminnerinn ershell.Form.FilterOn = True
End If
forms!frmoutershell.frminnershell.Form.lblfilter.C aption = strSQL
End Sub
Any help would be appreciated as I am getting quite frustrated with it only working on certain parts of the form.
Regards
Jason
View 3 Replies
View Related
Jun 5, 2013
I have a username combobox and a number combobox filtering a subform. If there is a userName but no number I want to pull all the records for that userName regardless of number and vice versa with a number and no userName. And if they both have something then both are being used for the filter.
I have been trying iff statements and isnull in query criteria and cant seem to find what I need.
View 1 Replies
View Related
Jul 29, 2014
The main form has fields for Record ID, Position, and Revision. The subform has fields for ID, Position, and Revision. There is also a field for "task". I have over 15 positions and 495 tasks. Each position has a set number (around 15 or so) tasks associated with that position.
I have the Position in the main form and the subform linked so when I select a position on the main form, the subform loads the same position. The question field (drop down) is "fed" from a query which contains all positions and all tasks. What I want the subform to do is when I select a position the drop down ONLY displays the tasks associated with that position.
I tried using an event procedure "On Click" and "After Update" to no avail. The embedded macro was:
Apply Filter Where condition= [tbl_Detail Cost Information]![Position]=[qry_attempt 1]![Position].
I also tried the reverse Where condition =[qry_attempt 1]![Position]=[tbl_Detail Cost Information]![Position]
The result is a fully loaded (all tasks) drop down.
View 4 Replies
View Related
Feb 9, 2015
I am using Access 2010. I have a subform(continuous form) that I display as a datasheet and allow filtering. I display the record count by using Me.Recordset.RecordCount in the subform's form_current event. This value updates properly based on the column filtering except when the filtering displays 0 records.
When there are 0 records, the form_current event does not fire and I cannot figure out how to trap when this occurs so that I can display '0 records found'. How I can tell when the column filtering causes 0 records to display in the datasheet? Is there an event that fires when the user filters using the column headings arrow?
View 5 Replies
View Related
Nov 5, 2014
I have not used access since Office 97 so, I see many changes. A while back I used Access to create some minor tracking databases. Now, with 2010 I'd like to modify the database that I am currently using. I have a main form that tracks daily trips or tasking(s). Within the form are two sub forms that track:
1. People assigned to the trip through a combo box; and
2. Itinerary for this trip.
I have been asked to add a Trip justification(s) through a combo box which will have several selections avail that can be chosen and would apply to each trip. These can be added to by double clicking the justification (figured that one out). What I would like the sub form to do for each new trip that is entered is to display only these values as a single selection rather than 12 times (example) if there are 12 trips that have the reason justification as part of the trip/tasking.
I just can't seem to make this work. The personnel one and itinerary one work just fine (previously existing). I just can't seem to get the new one to work. I have checked that the new table is connected through the relationships. In the exact same manner. The new form has the ID (Key) OPID (to link each trip separately) and justification text field.
View 6 Replies
View Related
Sep 25, 2014
I have a tab control at the bottom of my main form, and some of the tab pages contain subforms. On one of the subforms I have created a filter to divide the content into "complete" and "incomplete." I have also added a toggle button option group to the subform to toggle the filter (one button for "complete" and one for "incomplete"). I'm using a macro to apply the filter, but it isn't working. The filter does work properly if I use the "Toggle Filter" button on the Ribbon, but I want to create something a little more user friendly.
I have :
Main form: Search_by_name
Subform: Action_Items
Underlying table: tbl_Action_Items
Subform control: sfctlActionItems
Toggle button option group: tgl_Complete_Incomplete
Here's the macro as it stands right now:
If [tgl_Complete_Incomplete]=-1 Then
ApplyFilter
Filter Name
Where Condition =(([tbl_Action_Items].[Completed])=True)
Control Name [Forms]![Search_by_name]![sfctlActionItems].[Form]![tgl_Complete_Incomplete]
Else
RunMenuCommand
Command RemoveFilterSort
End If
I get the error message "The 'ApplyFilter' action requires a valid control name that corresponds to a subform or subreport."
If I remove the content of the Control Name field and open the subform independently (i.e. not as a subform), everything works fine.
View 6 Replies
View Related
Jul 1, 2014
I thought I was in the home stretch of my project, everything worked great when I was messing with 200 records. Now that I'm messing with 2000+ records, things are very slow. So a search form redesign!
I have a form (frmSearch) that has a subform (frmSubSearch) embedded in it. The frmSubSearch is a datasheet only that is just pulling its info from a query (qrySearch). qrySearch has about 8 columns of data in it.
On the main form I have a combo box that is feeding its list from the qrySearch using a SELECT DISTINCT statement. So a user selects an item in the combo box and my After_Update fires. This sets a filter on frmSubSearch. I have three of these combo boxes that can add to the filter and they work great so far.
But I want to have the combo boxes filter themselves based on whats left on frmSubSearch. So if a user selects something in the 2nd combo box, the sub form filters and updates, but then I want the other two combo boxes to only have valid selections, and not something selectable that would wind up giving me a blank sub form result.
I have tried using .Requery in various ways, but its not working. I have also been looking into the idea of Cascading Comboboxes, but these don't seem to quite fit what I'm trying to do.
View 9 Replies
View Related
May 30, 2013
I have these 3 combo boxes filtering results into a subform.
Code:
Private Sub Combo5_AfterUpdate()
If Len(Nz(Combo5, "")) > 0 Then
FindRFQsubform.Form.Filter = "[RFQ Title] = '" & Combo5 & "'"
FindRFQsubform.Form.FilterOn = True
[code]...
View 1 Replies
View Related