Filtering a form based on a filter from another form

J

John D

Hi all,
This is an entirely new database that I've been building from the
ground up. So far I've made a search form (frmSearch, has 5 lookup
fields in the header) that will look up values in the table and display
only similar results to the lookup fields, all in table format in the
details section of the same form. That works fine. Now what I'm
trying to do is this..
I want to be able to click on a line in the similar results table,
click a button, and have it display a second form (frmDetails) for that
entry with all the fields in the table arranged nicely.

Ive made a macro where if you click on the table line, and click a
button, it will Filter By Selection, but this only works in frmSearch
results table. How do I get this to apply a filter to frmDetails to
display just the one table line I want to view?

-John
 
G

Guest

John D,

You don't, you get the button to open a new form with the Where part of the
open arguments set to the single record you want displayed, rather than
trying to filter from *all* the records, easier to control using vba as then
you could put code in the Double_click event of the datasheet view in
frmSearch and have that code open the frmDetails to the correct entry;

Private Sub txtATextBox_DblClick(Cancel As Integer)

docmd.OpenForm "FrmDetails", , , "RecordIdentifyer = ' " & me.txtATextBox &
" ' "

End Sub

or something similar. If it's called from a command button say on the header
you will have to refer to the selected row rather than being able to use the
me.txt coding.

Have a look at OpenForm in help for more details.

TonyT..
 
J

John D

Ok, that kind of works. I got it to where I can double click on one of
the table listings. It will bring up a "RecordIdentifier=____" box, I
type in the ID of the record and it opens the second form with just
that record.
There a way to bypass the "RecordIdentifier=_________" input popup, and
just use the value for whichever record i double click on?
 
G

Guest

The me.txtATextBox should be the name of the field that contains the
Identifyer in each row, not necessarily that control that is being double
clicked - can you post the code you are trying, including the event part
please.

TonyT..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top