Tab control filter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a tab control that has five tabs for each workday placed on a form.
Is there a way to filter the records by date and a user-supplied ID? To make
the question easier, how do I filter the records on the first tab to include
only those with the system date (which is in a text box on the form)?
 
I have a tab control that has five tabs for each workday placed on a form.
Is there a way to filter the records by date and a user-supplied ID? To make
the question easier, how do I filter the records on the first tab to include
only those with the system date (which is in a text box on the form)?

The pages of a Tab control aren't actually designed to contain
different data. A Tab control is a tool to share screen space among
multiple controls. What's the structure of your Table or Tables? Do
you have textboxes bound to different fields on the tab pages?

You may want to consider putting a Subform on each tab page. For
instance: you could have a combo box on the mainform, cboID, allowing
the user to select the ID; and on each page of the Tab Control have a
textbox with a Control Source such as

DateAdd("d", 2 - DatePart("w", Date()), Date())

for the Monday tab, with 3 for Tuesday, ..., 6 for Friday. These might
be named txtMonday, txtTuesday, ... txtFriday.

Your five subforms would then have Master Link Fields like

cboID;txtMonday

and Child Link Fields referencing the ID and date fields in the
subform's recordsource query.

John W. Vinson[MVP]
 
John,

Thanks very much for the information. I followed what you mentioned at the
bottom of your post and am stuck again. I started off with a main form
containing one subform on the first tab of the tab control. I only want to
show today's records on that tab. I have a text box that has the system date
on the main form, and the main form is not bound to a recordsource. I also
have a text box on the tab for Monday that includes the Control Source
mentioned below. When I go to add the subform to the tab control, I don't
get an option for link child/master fields because the main form isn't based
on anything. I don't intend to show any data on the main form, only on the
subforms contained within the tabs. What can I do?

Thanks,
Melanie
 
John,

Thanks very much for the information. I followed what you mentioned at the
bottom of your post and am stuck again. I started off with a main form
containing one subform on the first tab of the tab control. I only want to
show today's records on that tab. I have a text box that has the system date
on the main form, and the main form is not bound to a recordsource. I also
have a text box on the tab for Monday that includes the Control Source
mentioned below. When I go to add the subform to the tab control, I don't
get an option for link child/master fields because the main form isn't based
on anything. I don't intend to show any data on the main form, only on the
subforms contained within the tabs. What can I do?

If you don't see the lines for master or child link field on the data
tab at all, you're probably looking in the wrong place: these are
properties of the Subform Control, the "box" which contains the
subform, not of the form itself.

If you see the line but aren't offered anything in the dropdown box of
choices, simply type the name of the control in the Master Link Field
property, and the name of the subform's recordsource field to which it
links in the Child.

Note that if the date field in the subform's table contains a time
portion this won't work (unless you put the exact time to the
microsecond in the textbox on the mainform). If that's the case, put a
calculated field in the subform's Recordsource query

DateOnly: DateValue([datetimefield])

and link to that.

John W. Vinson[MVP]
 
Back
Top