[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Opening a Form With Filtered Results And A Combo

Posted on 2011-04-26
15
Medium Priority
?
321 Views
Last Modified: 2012-05-11
Hi Experts,

I have a form (B) that is opened through a button on another form (A) that opens using a current record on form (A).

Once Form B is opened, it opens with filtered results. I have a combo box in form B that should usually change the data in the form according to what is chosen, but doesn't due to the filter.

The combo box is not the same data as the filter, but a subset of information within that filter. For example, if the filter was fruit, the the combo contains, apples, oranges, banana's etc.

I have tried putting criteria on the query that drives the combo box with something like Me.frmfruit.fruitID. Using this theory, I applied it in another form under the same scenario and that works perfectly. But this form, it doesn't work. Is that the right way of doing it? ie- Apply criteria in the combo box to tell it to use the current Fruit ID, but have a listing of all other fruits?  
0
Comment
Question by:jammin140900
  • 8
  • 7
15 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35466599
<Once Form B is opened, it opens with filtered results. >

is this good or NOT?

<I have a combo box in form B that should usually change the data in the form according to what is chosen, but doesn't due to the filter.>

do you want to change records based on the combo selection?


post the command line that opens form B
0
 

Author Comment

by:jammin140900
ID: 35467283
I need it to be filtered.

So it's opening on filtered WebsiteID which is great. Now I want to know whether I can sift through different 'Articles' using the combo box in Filtered Form B that belongs to the filtered Website ID.

Using my example of foods above, now that the form is open up on FruitId (doing away with VegetableID or MeatID!), I now want the combo box to be able to select any specific fruits. ie apple, banana, pear


Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmASArticleDetails"
    
    stLinkCriteria = "[WebsiteID]=" & Me![WebsiteID]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command39_Click:
    Exit Sub

Err_Command39_Click:
    MsgBox Err.Description
    Resume Exit_Command39_Click
    
End Sub

Open in new window

0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35467408
can you just use your actual fields from your db, trash that fruitID etc...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:jammin140900
ID: 35471646
I have websites which contain articles in them. When I open a form using a particular 'website' (WebsiteID), I want to know whether the combo box at the top which contains Article Title, can be used to select an article from that filtered WebsiteID, and change the form results based on the selection of the combo box.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35471747
better if you can upload a copy of the db
0
 

Author Comment

by:jammin140900
ID: 35472029

Ok. When you open the database, on the frmWebsite, using the 'Select Website', select "learntosing.com"

Click on the red button "Article Submitter Registration"
Click on the red button "Go To Article Details" in the form that opens

In this form (qryfrmArticleDetails) what I want to work actually works. By using the 'Select Article' combo box, I can select any article from WebsiteID = 13 and the form changes to reflect the selection.

Clicking on the red button "Submit Articles" to open the next form, this where using the same strategy doesn't work. If I tick a few boxes in the subform (just to note if the subform changes according to combo selection) and changing the combo selection, the subform data doesn't change.

Do you know why?
 Sample-Database.mdb
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35472072
there are no codes in the afterUpdate event of the combo box
0
 

Author Comment

by:jammin140900
ID: 35472254
Is there meant to be?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35472270
<Is there meant to be?>
that is the only way to change the subform data when changing the combo selection.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35472325
hmm, the Link Master /Child fields are set to ArticleID.

how do you want to filter the subform data? filter on what field?
0
 

Accepted Solution

by:
jammin140900 earned 0 total points
ID: 35472662
I fixed it!

I put into the combo box criteria: SELECT DISTINCT tblASArticleDetails.ArticleTitle, tblASArticleDetails.WebsiteID FROM tblASArticleDetails WHERE (((tblASArticleDetails.WebsiteID)=Forms!frmASSubmission!WebsiteID));

and also changed the previous form into opening this form on WebsiteID and not ArticleID. It means though that when entering the form, I need to select the article manually based on the filtered WebsiteID.

Thats ok though.  
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35474600
hmm, were the questions ask and comments posted did not help you to figure what to do?

also, even if you are the one asking/seeking solution, you need to respond properly to questions asks. it is for your own benefit.
0
 

Author Comment

by:jammin140900
ID: 35474656

No, in this case the questions being asked were things I already considered before posting this question.

Thanks anyway.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35474676
ok good luck to your project...
0
 

Author Closing Comment

by:jammin140900
ID: 35499841
After experimenting myself, I figured it out.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question