Filter Subform From Main Form Combobox

Jan 9, 2006

I have a main form with an unbound combo box. I also have a subform showing records in datasheet view.

on the after_update event of the combobox I want to filter the subform. Here is my code (note frmqrysubmittals is the subform and the recordsource for the subform is initially the RS1 portion of code):


Dim RS1 As String
Dim RS2 As String
Dim RS3 As String

RS1 = "SELECT tblSubmittals.SubmittalID, tblSubmittals.Format, tblSubmittals.[Specification Section], tblContractorInfo.Contractor, tblSubmittals.[Project Number], tblSubmittals.Description FROM tblContractorInfo INNER JOIN tblSubmittals ON tblContractorInfo.ContractorID = tblSubmittals.ContractorID"
RS2 = " WHERE (((tblContractorInfo.Contractor)=" & Chr$(34) & Me.cboContractor.Value & Chr$(34) & "));"
rs3 = RS1 & RS2


Me.frmqrySubmittals.Form.RecordSource = rs3
me.frmqrySubmittals.form.requery

When I update the cbo box the subform doesn't display any records. When I go to design view and look at the record source it displays the RS1 portion (the original RS), but all of the terms are placed in brackets [].

Note, the subform and contorl are both named frmqrySubmittals.

I've been at this for days. What am I doing wrong?

Thank you everyone for your help. This group has been a great resource over the past few months as I stuble through learning Access.

View Replies


ADVERTISEMENT

Subform Based On Selection Combobox In Main Form

Aug 25, 2005

Hello.
I am trying to make an invoice sheet in Access 2000.
My program consists a Order Sheet (frmOrder2), Delivery (frmDelivery) Sheet and a Invoice Sheet (frmInvoice).
All three are linked by DoNo.
The DoNo is made by frmOrder2.

I have a form that is called frmInvoice and a subform called subInvoice.

What I basically want to do is, to get the subform (subInvoice) to show records depending on the selection in the combobox DoNo in the main form.

subInvoice should show the Items, UnitPrice, Amount, TotalPrice, Remarks. These Items should show the records of frmOrder2.

I am kind of confused and totally lost, because I have no clue how to start!
And I am quite a beginner so, bear with me! Thank you!

View 4 Replies View Related

Queries :: ComboBox On Main Form To Populate Subform

Nov 29, 2014

Database that will show both his side income information as well as his regular income and expenses. I have constructed a tables for the categories, his rec/payables which has information for both his personal & business, the other table he wants to filter only information regarding the business. I set up a form with a subform (business). I need the combo box in the main form to auto populate the matching fields in the business subform, everything but the client name and id. I have tried creating a query for criteria business, it works in query mode but not when I try to use it on the form.

The main form:
IncSrc IncAmt ExpSrc ExpAmt ActionDate

The subform
IncSrc IncAmt ExpSrc ExpAmt ActionDate ClientName ClientID

View 2 Replies View Related

Filter Main Form From Subform

Nov 16, 2005

I have a main form that contains basic project information, and one of many subforms that contains project manager and contract information. (forms and subs linked by project ID) My project managers want to have the ability to only show project records that are theirs. I can make a filter based on any field in the main form without a problem using code like below.

Dim strFilter As String
strFilter = "ILFID Like '*FME*'"
Me.Filter = strFilter
Me.FilterOn = True

How do I write a filter to reference the project manager field in a subform that will actually filter the main form and subform records?

Thanks!

View 7 Replies View Related

Forms :: Filter Subform From Main Form

Jun 27, 2013

All using 2010. I need to filter a subform from the main form.

Code:
sfrmMedCInfo.Form.Filter = "[SSNum]= '" & cboSSN & "'"
sfrmMedCInfo.Form.FilterOn = True

It's throwing an error: Variable not defined pointing to sfmMedCInfo. why do I need to declare the subform and how?

View 3 Replies View Related

General :: How To Filter Subform By Drop Down In Main Form

Mar 19, 2014

I am self thought and fairly new to access (quite fun )

It is a simple setup: I have a main form called "customer_information_display_form" within that form is a sub-form called "customer_information_form" in addition there is one combo box drop down menu

I would like to filter the information presented in the sub-form by company name located in the drop down menu.

View 3 Replies View Related

Forms :: Filter Subform Results By First Letter In Main Form Field

Apr 30, 2013

I have a Main form with a sub form.The main form is a customer record (form view), and the sub form is all other customers (same fields) datasheet view.I have a navigation bar to filter (using different queries) the results in the sub form

same postcode
Same company (different location)
everyone except Main form customer

I cannot get a different filter (Query) to show only customers whose name begins with the same letter as the customer in the main form?I have been trying Like but think I am referencing it wrong, as it prompts me to enter a value rather than using the value in the field in the main form.This is what I have in the query (of the subform)

Customer ID: <>[Forms]![NewAllCustomerListF]![CustomerID]
Customer Name: Like "[Forms]![NewAllCustomerListF]![CustomerName]" & "*"

View 2 Replies View Related

Forms :: Applying Quick Filter In Main Form Causes Data To Not Show In Subform?

Sep 3, 2013

I have a pretty simple form that includes subform. Subform's table is linked to main form's table with parent/child relation. Connecting fields are main table's ID field and corresponding field in child table. Subform is in datasheet view. This is pretty basic stuff so there should not be any problems, but every time I apply a quick filter in main form it causes data in subform become invisible. There is single row in subform, but all it's fields are empty.

View 5 Replies View Related

Filter Main For Based On Subform Criteria

May 2, 2005

Hi,
I've posted this same question a few months ago, started something else and forgotten about the problem, now I really need to solve this! (I had no luck with the original post - code still not working).

I want to apply a filter to my main form based on criteria showing on a subform. This is the code I've got (applied to the OnOpen event of the main form):

Code:Private Sub Form_Open(Cancel as Integer)Dim stDocName As StringDim stLinkCriteria As String stDocName = "Campaign Form"stLinkCriteria = "[Forms]![Campaign - Last Contact Status subform]![Communication Response]=1" DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria, acFormPropertySettings, acWindowNormalEnd Sub

The main form is called Campaign Form
The subform is called Campaign - Last Contact Status subform
The field I want to filter on is Communication Response

The criteria I want to filter is : I only want to show records from the Campaign Form (main form) where the status of the Communication Response on the Campaign - Last Contact Status subform (subform) is equal to 1.

I've tried a few variations of the above code but the results are always the same - prompting to enter a paramater value. Now I'm just fishing and hoping I'll get it right.

FYI. the subform only contains one record for each record on the main form. It works a bit like this :
Customer||Date||Communication Response(1=open, 2=closed)
One||20/4||1
Two||21/4||2
Three||21/4||1
One||23/4||2

The corresponding record on the subform for customer One will show the communication response of 2 as this is the most recent date. Therefore you now have the following :
Customer||Communication Response
One||2
Two||2
Three||1

Now I want to only show those records that have a Communication Response of 1. Remember this field appears on a subform. This is the part I am having trouble coding.

I know I've probably just explained the most irrelavent details but if anyone can help me it would be greatly appreciated!!

View 1 Replies View Related

SubForm Filter Based On A ComboBox

Aug 18, 2006

I am running into a problem with just one form in my database. I was getting the error 'Can't build a link between unbound forms'. After searching here and elsewhere the solution is/might be to type the linked fields into the child and master proprty fields. However when I do that I still can't get this form to work. Would anybody please take a look at the file attached - I trimmed it down to two tables with a few records and a form/subform.

I want to make a selection in the combo box and have the filtered results displayed on the form below - simple and I have done the same thing in the database elsewhere but I just can't see why it won't work here.

Thanks

Steve

View 3 Replies View Related

Forms :: Using Combobox To Filter A Subform

Jan 14, 2014

I do review SQL sometimes to check what's going on. Access has been a steep learning curve, but my understanding of queries and relationships improved a lot recently.Some of the finer points of forms are just giving me frustration. My form related knowledge probably lags behind my data/table/relationship/query related knowledge. Its probably simple, but as you know these things are not too intuitive at first.

I have a query which (built on another query and some tables in turn) delivers exactly the data I want. I want that data to come up in my form (or datasheet subform actually) BUT, I want to be able to filter for PERSON.ID. I want the user to be able to use a combo-box to do that filtering.

OK then, main form, with unbound combo-box at the top. I assume it should be unbound because I don't want any data edited based on selections which are supposed to cause temporary filtering only (correct me if I'm wrong). For the Row Source I've used a qryWholeName. This query creates a WholeName for each person, and includes their PERSON.ID as well.

[URL]....I cannot see the example DB they have attached in the thread. Finally, my database is likely to be accessed by several people at once. Different users will want to be selecting and filtering for different people simultaneously.

View 3 Replies View Related

Modules & VBA :: Filter Subform By Nth Column In Combobox?

Aug 5, 2015

I am currently having trouble filtering my subform by a different column than the bound column set in properties.

the comobobox shows the ID for the last email sent, with the combobox drop down showing the name and date of email when dropped down. I have tried 2 things and neither work...

1) Calling the filter on the combo-box column itself:

Code:

Dim myDate as string
myDate = [Forms]![BenSearchForm]![BenSearchSub]![LastEmail].[Column(5)]
DateFilt = " AND" & myDate & " BETWEEN " & "Nz([forms]![BenSearchForm].[Date3],#1/1/1900#) AND Nz([forms]![BenSearchForm].[Date4],#31/12/2100#)"

I have used similar code on another form, but I can't get the myDate variable to get to value of the 6th column in the dropdown (Date Of Email). an Easier way to look at this would be:

Code:
DateFilt = " AND [Forms]![BenSearchForm]![BenSearchSub]![LastEmail].[Column(5)]" & " BETWEEN " & "Nz([forms]![BenSearchForm].[Date3],#1/1/1900#) AND Nz([forms]![BenSearchForm].[Date4],#31/12/2100#)"

2) Inside the subform, I have set up a seperate field that reads the result of the dropdown box column(5) and shows it. For example the Email with ID 22 has a date of 4/8/15, so any record with last sent email being 22 has a record that says 4/8/15. I am trying to use this value to filter between, but am unable of passing the value to my filter.

The textbox is called "Email Date" and the Control source is "=[Forms]![BenSearchForm]![BenSearchSub]![LastEmail].[Column](5)"

It shows the correct data, but does not allow me to filter by this field, when the apply filter button is pressed it asks me for the parameter value of the LastEmail Field.

Code:
DateFilt = " AND" & " [EmailDate] BETWEEN " & "Nz([forms]![BenSearchForm].[Date3],#1/1/1900#) AND Nz([forms]![BenSearchForm].[Date4],#31/12/2100#)"

I use a number of set variables for my filters, so my filter ends up looking like

Code:
.Filter = IDFilt + EmailFilt+ DateFilt

where all but IDFilt begin with AND. I use this on a number of other forms so I am sure this is not the issue!

View 3 Replies View Related

Forms :: Filter Subform By Months Using Combobox?

Aug 18, 2015

I made a subform based of a query that I put in a main form. The subform contains a date field, where a full date is inserted (example 24.12.2015.). What I am doing is making a form where the subform would be filtered by a combobox by months. This may be wrong (correct me if it is), but for values in the combobox I placed number from 1 to 12 (as months). This combobox would then only show records from that month. I used a Change function in VBA on the combobox but I keep getting an error.

This is the VBA on the combobox where I change the record source of the subform. I probably made the WHERE part wrong but dont know how to fix it.

Combobox name is cboMonth.
Field where the full date is, is DateOut.
Subform is called subCustomer.

Code:

Private Sub cboMonth_Change()
Dim SQL As String
SQL = "SELECT qryCustomers.SID, qryCustomers.KID, qryCustomers.MMT, " _
& "qryCustomers.Owner, qryCustomers.User, qryCustomers.Policy, " _
& "qryCustomers.DateOut " _
& "FROM qryCustomers " _
& "WHERE Month([DateOut]) LIKE '*" & Me.cboMonth.Text & "*'"
Me.subCustomer.Form.RecordSource = SQL
Me.subCustomer.Form.Requery
End Sub

View 4 Replies View Related

Why Is Main Form Update Event Triggered When Subform Dirties Main Form?

Dec 1, 2005

I have a subform which makes a change to a field on the main form. When focus is returned to the main form, the BeforeUpdate and AfterUpdate events fire. Why? I thought from the form's perspective, the subform is just another control.

BTW, I get the same behavior if I modify the field from within the Exit event of the subform control.

In either case, the main form's Dirty event is NOT triggered.

View 2 Replies View Related

Using A Combo Box From Main Form To Filter In A Function

Aug 26, 2015

=Sum(IIf([Pass or Fail]="Pass" And [Pay Period]="02" And [Location]="Purple",1,0))/IIf(Sum(IIf([Pay Period]="02" And [Location]="Purple",1,0)) = 0, 1, Sum(IIf([Pay Period]="02" And [Location]="Purple",1,0)))

For [Pay Period] ="02" is there a way to make it filter by a combo box from the Mainform? This code is on a Subform the combo box is on a Mainform

Forms![Overview_]![Combo35] <the path for the combo box.

I tried inserting it where the 02 was but it just returns 0 and if I remove the "" it will error the whole thing out. Same if I try to just remove the [Pay Period]="02" and replace it fully it errors out.

View 5 Replies View Related

Requery Subform From Another Subform Both Connected To Main Form

Aug 8, 2014

I have a main form that has two subforms, subform1 and subform2, both connected to the main form. When I enter data into a field in subform1 I want subform2 to requery and update to show the calculated results from the new or changed data in subform1.

I found that if I do a refresh it works when changing the data but not when entering a new line of data in subform1. I tried some code in the after update field of on subform1, but cannot seem to get anything to work.

Me.[subform2].Form.Requery

Does not work. It errors and says it cannot recognize subform2 as a field. I have tried a field name on subform2 but I still got the same error.

View 1 Replies View Related

Filter Records In A Form Using A Combobox

Feb 19, 2006

Hi everyone

I use Access 2003 and saw Ken Higg's sample database to filter records in a form using a combobox. I managed to replicate his settings and wondered about an extension to the principle, but I don't know if it's possible.

In the sample, a value is selected using a combobox and all matching records are filtered so it's possible to scroll through them. Is it possible to have a second (or more) combobox on the form so it is possible to filter on one or another criterion? This would mean one combobox filling the other one and I realise that the one that Ken provided is unbound.

The reason that I'd like to do this is, for instance, if there are records with Surname, 1st, 2nd and 3rd lines of the Address and Postcode, I may wish to filter records by entering the Surname or Postcode. Each of these fields would have to be displayed in a combobox. As the sample is set up at present, only one of the Surname or Postcode has to be selected via the combobox and the other is a textbox.

It may be that what I'd like to do isn't possible - or someone may have come up with some other idea. I'd prefer to have the search/filtering on the form, rather than using the buttons on the Form View toolbar.

Thanks for your patience.

Juan

View 7 Replies View Related

Forms :: Filter Combobox Continuous Form And Print

Mar 3, 2014

I have almost completed creating a continuous form which I want users to be able to filter though the records based on to/from date, badgenum and a response string.

I then want to have a button, btnSelect, that will select the remaining records and open a report based off only the remaining records.

1.) Everything on the continuous form works except when trying to filter a combo box, cboBadge, field name "BadgeNum". BadgeNum is data type "short text". I have modified the code below from the following Allen Browne link. It keeps throwing a debug on me.Filter = strWhere at the bottom of the btnFilter sub.

2.) As far as the btnSelect and printing remaining records, I guess I'm not sure where to start.. I currently have another print button that will print individual records only which works fine.

[URL] ....

Code:
Private Sub btnFilter_Click()
Dim strWhere As String 'The criteria string.
Dim lngLen As Long 'Length of the criteria string to append to.
Const conJetDate = "#mm/dd/yyyy#" 'The format expected for dates in a JET query string.

[Code] ....

View 4 Replies View Related

Modules & VBA :: Creating Textbox In Form To Filter Combobox

Sep 16, 2014

I have a subform in datasheet view for tracking calls from clients. The Client Name is a combination of the first and last name. I want to create a text box that allows me to start typing in the client name and it will filter for only those Clients that match. Currently, I have the following code (below) for the textbox, however when I start typing in a client name all the clients disappear from the table. The client name is in a combo box so I don't know if that is making a difference.

Private Sub Text3_Change()
Dim strFilter As String
Me.Refresh

[Code].....

View 3 Replies View Related

How Can I Filter One Combobox Based On Another Combobox Selection?

Apr 22, 2005

I have 2 comboboxes, the first one is called "activity", whereby I have 3 options to choose from, and the second is called "level".

When I click an "activity", for example Drawings, I want the "level" combobox to list a unique set of options for that category. and if I click on a different "activity" for example Planning, I want the "level" combobox to show a completely different set of options.

If anyone can give me any help on how to do this then I would be very grateful!!

Thanks

Angela :eek:

View 2 Replies View Related

Get Subform's Control In The Main Form.

Feb 21, 2005

Lets say I have Form A and Subform A with the parent-child relationship established that works well. Subform A has a Text box control that is getting display when I include the subform in Form A.


Now, I decided I dont want to include subform A in the Form A. Is there a way for me to show the contents of that Text box control in Form A without attaching the subform in the main form (Form A)?

I read somewhere that to refer a control on a subform, I have to use the code - Forms!mainform!subform.form!control. But this would be in VBA. What is the equivalent of this in a Control Source in the main form?

If I have not explained myself correctly, please do let me know.

To summarize, my question is without including the subform, I want to reference the values of the subform in the mainform. (I have some design necessity for this requirement) Is there a way for this?

thanks!

View 1 Replies View Related

Returning To Main Form From Subform

Apr 25, 2005

Hi,

I've a form that has 2 subforms - which subform is used is dependant on the selection of a combo box in the main form. After much time spend trying to set this up I am happy to report that this section works fine.

My problem is that when I have completed the subform I am not able to continue tabbing through the rest of the form.

Any help would be great,

thanks
Barry

View 1 Replies View Related

Tabbing From A Subform To Main Form

Jun 29, 2005

everytime i try to tab from my subform, it creates a new record for that subform. Also, about the subform, the control that links the main form and sub form is unique.
I have now set my Cycle property on my subforms and forms to Current Record. How can I tab from the subform to the main form and vice versa?

Thanks!

View 1 Replies View Related

Main Form Update To Subform Value

Sep 2, 2005

hi

i have a main form, which has a subform (subform1)

subform1 has a further subfrom (subform2)

in the subform2, i have a value, which on a double click, i wish the main form critical value to refresh to

thereby the main form refreshes to the value of the subform 2 value

i cannot work out the code, you may have guessed from the description of the question, i am a bit of a novice.

could anybody assist, please

View 2 Replies View Related

Main Form And Subform Issue

Oct 21, 2005

Hi, I have this main form, "frmMainPatient" and I am trying to add in another Main form "frmFim2" as a subform into frmMainPatient. I am running into some issues. Can someone take a look and tell me what I am doing wrong. Thank you,

View 2 Replies View Related

Tabbing Between Main Form And Subform

Nov 18, 2005

Hello all,

This is my first post to these forums, however I have leeched so much information off of all you guys that I can't even begin to express my gratitude. So, now, onto my problem...
I'm developing a form for our call centre people to enter information regarding customer returns. Customer orders are placed on one of two systems. In my form, when the person is entering info, I have a drop down box to choose between the two systems, which calls up a respective subform to enter system-specific information. The problem I have is that I can use tab to enter the subform, however I can't use it to get out. There are two records in the subform - order date and order number. After I enter info into these 2 textboxes and try to tab out, it seems that the subform goes to a new record. How can I get my form to tab into the next required field on the main form? Hopefully this makes sense, I just read through it and its kinda questionable. Thank you very much in advance.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved