08. december 2004 - 08:52Der er
36 kommentarer og 2 løsninger
Filtrere data i formular
I de fleste af vore databaser, er søgeformularerne bygget på en tabel, dvs. Postkilden er navnet på en tabel. Er det muligt at lave det så postkilden er RecordSource fra "hovedformularen"? Hovedformularens navn: Ordreseddel
I have a main form, with a button on, that opens a search form. the search form lets you set e.g. a date range (guess you can call it an advanced filter) Normally the main form has a table as it's "source" (Postkilde in Danish), but in this case it doesn't, it's built from a query, that changes every time a selection on the form, Ordrelinier, is made. I would like for my search forms "source" to be .....what... me!Ordrelinier......something....
You could also pass the recordsource FROM your main form to your search form in the OpenArgs paramater when you open the from, then set this in the On Open event.
something like this DoCmd.OpenForm "YourForm", , , , , , Me.RecordSource
Then in the Search form
If Len(me.openargs) > 0 Then Me.recordsource = Me.openargs end if
I assume that you know which table the query is based on? Then you could use the method I describe to sentthe table name to the search form. But this may mean that the search form also needs to be changed because field names etc. dont have the same name.
Må kigge lidt på Terry's forslag om Search Manager Pro også, men forsøgte med dit forslag, thomas. Satte en VedKlik event på knappen på min hovedformular, Ordreseddel: Forms![Transporter].RecordSource = Me!RecordSource DoCmd.OpenForm "Transporter" Men fik en fejl: "Kan ikke finde feltet "Recordsource"...."
I though about that Thomas but that will give the whole query and not just a table and thats what puppetmaster says (or at least I think he does) that he doesnt want.
Rettede den til Me.RecordSource, så forsvandt fejlen, men linien DoCmd.OpenForm "Transporter" fremkalder nu en fejl: "Formularen Transporter kan ikke findes".....den ER der.... :(
Forms!Ordreseddel!Transporter.Form.RecordSource = Me.RecordSource DoCmd.OpenForm "Transporter" Resulterer i: Kan ikke finde feltet "Transporter", der refereres til i udtrykket.
I think we are getting all mixed up in the form names! We need the name of your main form and if it has a sub form which contains the record source then we need taht forms name too. Then we need the name of the MAIN search form and also the sub form name if it has one too!
terry, I might have explained it wrong! :( Sorry I have a form (Ordreseddel) with some data. These data I need filtered. For this I want to open another form (Transporter), on which the user can set criterias
Oh....Oh! I guess I got it ALL wrong! :( I DON'T need to "base" my search form on a recordsource at all, I just need to "read" the variables from the search form and set the form Ordreseddel's recordsource to the filterstring!
so I assume that you are setting the filter property on the search form?
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.