Filter a subForm

  • Thread starter Thread starter Bob Vance
  • Start date Start date
B

Bob Vance

On my main form I have a ComboBox(No dropdown list on Control Source) which
has to fields, HorseName,HorseID only the first column shows HorseName, On
my sub form I also have HorseID , how can i filter HorseID to my subform
when my main form is opened. HorseID is a number field
 
Do you have horseid in the underlying query of the main form?

Or is Horseid the BOUND column of your combobox? You can control the
filter of the subform by using a control reference instead of a field
reference in the LinkMasterFields property of the subform.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
On my main form I have a ComboBox(No dropdown list on Control Source) which
has to fields, HorseName,HorseID only the first column shows HorseName, On
my sub form I also have HorseID , how can i filter HorseID to my subform
when my main form is opened. HorseID is a number field

You should be able to set the Master Link Field property of the subform to the
name of the combo box. The Bound Column property of the combo should be the ID
(it would generally be set to zero width in the ColumnWidths property since
the user won't need to see the numeric ID).

The combo box name won't be one of the options in the dropdown list for the
subform's master link field but you can type it in.
 
Thanks Guys, My Combo box is Unbound and has 2 columns HorseID & HorseName,
HorseID is hidden, I have tried cbHorseName(0) In Master Link Field and
HorseID in Child link Fields but to no success, what am I doing wrong!
Thanks Bob
 
Found out what I was doing WRONG! I had no HorseID numbers in my table
because I only just created it to be done, Going great now thanks
Guys....Bob
 
I suppose I cant get rid of the last record "Null" that shows in my filter!
Thanks Bob
 
I suppose I cant get rid of the last record "Null" that shows in my filter!
Thanks Bob

Perhaps if you'ld explain what your filter is, or where (on what form, object
or control) the null is showing someone could help.
 
Thanks John, I will live with it as I am only showing 4 records so it will
drop off
regards Bob
 
Thanks John, I will live with it as I am only showing 4 records so it will
drop off
regards Bob

If you just don't want to see the blank "new record", and prevent the addition
of new records to the subform, just set the Subform's Allow Additions property
to No.
 
Back
Top