Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Divide Records over different Tabs 2

Status
Not open for further replies.

kimx

Programmer
Feb 14, 2001
13
0
0
BE
Hey !

If people have read my previous post, this is my second question:

I'd like to achieve something using a Tab Control, but don't even know if that's possible.

Some background info:
I've got a mainform, let's call it frmCustomers with Record Source the
customers table tblCustomers (not the real names but to keep it simple).
This form has a subform frmsubOrders, which was based on the tblOrders table. The tblOrders table
has a field 'Current' (Yes/No) indicating which is the current order.
There's a PK relationship between CustomerID (tblCustomers) and fkCustomerID (tblOrders) )


What I'd like in the subform: a tab control with first tab = 'current orders' and second
tab = 'previous orders'. This means that for 1 customer in the main form, all orders with
Current = True would appear on the first Tab, and all orders with Current = False would
appear in the fields on the second Tab.

What I can think off is creating a tab control on the main form and put a Subform1 on the
first Tab with subform using Record Source = saved query 'select * from tblOrders where Current = True'
and on the second Tab another subform Subform2 using Record Source = saved query 'select *
from tblOrders where Current = False'.
But this is quiet static.

Does anybody knows if this can be done using 1 subform (with tab control) and programmatically
positioning the records on the right tab ?

Thanks for any suggestions !!!

Regards,

Evelyne

 
If I understand this You are after one subform that will display current of previous orders?

Why not on your subform Have a toggle button that changes the recordSource of the subform, the Toggle button event code could look something like this.

If Toggle0 = -1 Then
Forms![MainForm]![SubForm].RecordSource = "Query1"
[Toggle0].Caption = "Current Orders"
Else
Forms![MainForm]![SubForm].RecordSource = "Query2"
[Toggle0].Caption = "Previous Orders"
End If

You will need to decide on the default value when you enter the form and either set the toggle button to -1 or 0
 
Thanks Chris !
I was probably making it too complicated. I just started with all this and don't know what to use anymore.
I just read some stuff about what you suggest and I'll certainly try it out. But what's the difference in between doing it with .RecordSource = Query1/2 OR use table as Record Source and use filter in code ?
I'm reading so many different solutions and stuff about DAO and ADO and local tables or with SQL server etc....
When do I use what ? Don't understand.

Respectfully,

Evelyne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top