Showing certain records

RonnieODIN

Registered User.
Local time
Today, 20:09
Joined
Jun 15, 2012
Messages
46
Hi

I have a form with a subform on which I have some random records not necessarily successive. The number of records is incistant.

What I would like to do, is to open these records in a new form.

Anyone have an idea of how to do so? Is it at all possible?

Also - I am still quet new to Access so help should be as down to basics as possible.

Thanks
 
The forms are linked by ID's yes.

I only get one record at a time. I may not have been clear, but what I would like to do is - when pressing a button - to open all listed records shown in the subform (which is filtered).
 
Precisely what I'm referring to. Use the code given and pass the filtered values to the parameter mentioned in the link.
 
I can't make it work. I have suited the code for my application:

Code:
    Dim rs As Object
    Dim lngBookmark As Long
 
    lngBookmark = Me!subKoder.Form!KodeID
    DoCmd.OpenForm "frmRetKoder", , , , , acDialog
    Set rs = [Forms]![frmRetKoder].RecordsetClone ' This is where the bug appears. 
    rs.FindFirst "KodeID = " & lngBookmark
    Forms!frmRetKoder.Bookmark = rs.Bookmark

The form will open unfiltered and when I close it the bug is shown.

I cannot figure out what's wrong.
 
Right, but that's not the code I advised you should use. Yes I know you got the code from baldy's website but in another link and that's not what you should be using.
 
But as I mentioned earlier: Using the code on the first page only returns 1 record for me.
 
You didn't show me what you did!! Isn't it the filtered list that you want to display?
 
Sorry for my late response.

I have tried both of the following codes:

DoCmd.OpenForm "frmRetKoder", , , "KodeID = " & Me!subKoder, , acDialog
DoCmd.OpenForm "frmRetKoder", , , "KodeID = " & Me!subKoder.Form!KodeID, , acDialog

The first line will result in error while the second line will display only one record in the opened form.

Yes, I want to show all the records in my subform. These records are filtered.
 
* And your subform is currently displaying all filtered records?
* What is the name of the field that links the subform to the parent form?
 
Yes, my subform is showing all filtered records matching the criteria. E.g. I had 4 records in my subform but only one record (the first) in the opened form.

The name of the field related to the main form is "MaskineID" but I also have a tabbed control which a field called "KomponentListeID" is related to. The PK for the filtered records is "KodeID" though.
 
It is the MaskineID field you should be using to filter the form you're opening.
 
What if I need it to be filtered on the "KomponentListeID" as well?
 
You use the AND keyword. Something like this:
Code:
DoCmd.OpenForm "frmRetKoder", , , "MaskineID = " & Me!MaskineID & " AND KomponentListeID = " & Me!subKoder!KomponentListeID, , acDialog
 
I can't find out how to use the AND keyword.

Code:
DoCmd.OpenForm "frmRetKoder", , , "MaskineID = [Forms]![frmInfoMaskiner]![MaskineID]" And "KomponentID = [Forms]![frmInoMaskiner]![KtlFane45] + 1", , acDialog

When I am having only one of the IDs in the condition I get the records sorted. But no matter how I try to combine them using the AND key I can't make it work.
 
Look very closely at my example. What you've done is not the same as the example I gave you.
 
Thank you VERY much. Now it is fanally working. Thanks for your time, it is very much appreciated.
 

Users who are viewing this thread

Back
Top Bottom