Filter a subForm

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
 
J

John Spencer

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
'====================================================
 
J

John W. Vinson

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.
 
B

Bob Vance

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
 
B

Bob Vance

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
 
B

Bob Vance

I suppose I cant get rid of the last record "Null" that shows in my filter!
Thanks Bob
 
J

John W. Vinson

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.
 
B

Bob Vance

Thanks John, I will live with it as I am only showing 4 records so it will
drop off
regards Bob
 
J

John W. Vinson

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.
 

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

Similar Threads

Query Expression Help! 26
Continuous Form Question 5
4 #Error Lines in a Query 2
Stop some records sending table! 0
Add another Combo Box Question! 3
Combo Box Filter 3
Filter Question 1
Getting a report to Filter 5

Top