Full Version: Tab Control
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
nickynoo
I am trying to make a form for my database, it is a database that contains many customer details. On one part of the form I have a tab control setup (well Im working on it) to show some of the details as tabbed pages - I had to do this to save space. However on one of the tabs - CONTACTS - I would like to add a tab control onto that page since the contacts I need displayed there are going to take up space, and I expect the amount of contacts to be displayed to grow as time passes - hence the need of a tab control to save on space. I have also got another page on the original tab control (called ADDRESSES) It is going to need to display at least three addresses on that tab - however I would like to display these as a tab control setup since it will make for easier reading.

My Problem
I cannot seem to add a tab control ontop of another tab control, it seems to appear on all my tab control pages (basically on the main form itself) Now I assume tab control are sort of like layers - is the some way to move a control onto a different "layer" (in this case a tab control onto an existing tab control).

Im also worried that this setup of tab controls ontop of tab controls is going to become confusing to people using the database - any suggestions that I can use to "lessen" the confusion? The tab control setup seems like the solution though.

Im using Access 2007
Alan_G
Hi

You can't add a tab control to a tab control directly as you've discovered. What you can do though is to add a tab control to a different (new) form, then add that new form as a subform to your original form's tab control on the page you want it to appear.

Format the subform control as you want it and it will appear to all intents and purposes that you have a tab control on a tab control <
nickynoo
Thankyou - will give it a shot
Alan_G
yw.gif
nickynoo
Hi

I have a bit of a problem. Ive been busy designing a form for my database - its a customer details/orders database. Im busy working on the customer details part of the database.
As you can see my form is far from complete, I originally inserted 10 fictitous companies into the database to see if it worked as it was supposed to. However on closer inspection I see the amount of records (which should be 10) has increased to 30. They only reason that I can think of for this is because something got mixed up or something in the past. As I say I only noticed the problem today so I dont know if it was ever right. I have been thinking of possible causes and I worked out that all of my (10) records are somehow being repeated to give me 30 records. One of the "bits of information" that I am collecting from customers are addresses, there are 3 types (namely physical, postal and delivery addresses), hence 10 x 3 = 30.

So I think this is the problem but I have no idea how to fix it - PLEASE HELP!

My strategy for building my database is to work on one section at a time and thereby gain experience to build the later and I suspect more difficult sections. I am also trying to teach myself as I go along.

My database
Alan_G
Hi

Your problem is because of the three address types that exist for each company, which means the query that you currently have as the record source for the form is producing 30 (10 companies x 3 address types) records.

I've taken out the address types from the query (in the modified attachment) so that the query now returns just the 10 records you want. To get the addresses for each company, you'd generally use a subform which you'd add to the address tab of your tab control
Bob G
What makes you think that what you are seeing isn't correct? If you are thinking like it would look in an Excel worksheet that may be what is confusing you. If you have the address type, then some will have 1 address line and others may have 2 or 3. Far easier to work with in the future than having to search 3 different columns.
nickynoo
Hi

Thanx for your help Alan, its showing the correct number of records now. I do want to add the addresses and other stuff but as sub forms.
Also I dont understand what you did to fix it, I was under the impression that my form was based on the underlying tables and not a query

@Bob G

CT as in Cape Town, South Africa ?
Im from Durban, South Africa, have lived in Cape Town and am now in Philippolis, Freestate, South Africa.
Bob G
CT as in Connecticut, a smaller state in the U.S. Just east of New York.
nickynoo
Sorry for the mix up.
Alan_G
Hi


You have as the record source for the form an SQL statement (ie a query), so that's the underlying recordset of the form, not the individual tables that make up the query. By removing the address types table from the query you're getting the records you're expecting as in effect it removed the x 3 multiplier
nickynoo
Let me understand this correctly.

Even though I didnt specifically make a query (to base the form on) a query was automatically created by Access showing the various fields from the various tables that I used to "compile" the form. What you did was go to the query (the record source for the form), the word at the beginning is SELECT (meaning its a select query), and you edited the reference to ADDRESS TYPES out of the query. Am I correct?

I deduce that unless all the fields displayed on a form are from one underlying table the record source will be a query.
Alan_G
Hi

You didn't create a saved query object as the recordsource for the form, that is you didn't create a new query and save it as an object and then use that as the forms recordsource, you clicked on the three little elipses which opened up the query builder. The query that you built wasn't saved as a separate query object, but it generated an SQL statement (which is actually a SELECT query) which was placed in the forms RecordSource property - that's the long text string you can see in there.

You could just have easily created a separate query and bound the form to that which would have done the same thing.

I removed the address type table from the query completely

Make any sense ?

Incidentally, just so you're aware, you probably wont be able to add/edit/delete records from the form as the query (recordsource) will be very likely not an updateable one
nickynoo
Hi

Heres what happened when I made the form. I saw it was base on a query (I deleted the query and saw the form didnt work). Then I created a new form with the same fields as in the originally form I had deleted. I opened a new form and went to that thing at the top in the ribbon that says ADD EXISTING FIELDS or something like that. I drag fields from the relevant tables onto the form. I think I mistakenly dragged addresstypes onto the form, I deleted the addres types field on the form - the query probably wasnt updated. And thats how I got the form.

This updateable query thing - lets fix that up now. I have no idea that a query could be un-updateable.
Alan_G
Hi


Yep, for lots of reasons. Have a look here for some info
nickynoo
Hi

Ive tried adding something to one of the form fields and it does seem to update the underlying table.
Alan_G
Hi

I guess you have an updateable query then <

I didn't check it, I just guessed it wouldn't be updateable due to the number of tables you have in the query which is why I said <<probably wont be able to add/edit/delete records>> <
nickynoo
But if it happens in the future - how do I change it?
Alan_G
Hi

Have a look at the link I posted in #15 above
Alan_G
........or this link to the info from Allen Browne
mike60smart
Hi

Following on from Alan's comments

See the modified Db attached

The Main form's Record Source is now based on tblCompanies and NOT a Select Query

The Subforms are based on their respective tables

Click to view attachment
nickynoo
Hi, this is exactly what I want.

Thanks for all the help. An ungrateful person would pass this off as something they did themselves, but not me Ill be going through every little bit of what you have done - not only to figure out "how it all works" but also to gain much needed knowledge. Expect questions.
nickynoo
Im back - sorry was sick and had family crisises to deal with.

Im uploading my database Ive had a bit of help from various people - thankyou.

What I am trying to do now is get the fields (that display on my main form) to display the correct information and not just the numbers of the various "IDs" that I have got. If you look on my form I have a number in certain fields eg. 2 --- this means absolutely nothing to me, I need to see what a "2" in a particular field represents, also there are alot of these same type of "numbers" on my form.
nickynoo
Please help me.
cpetermann
Nick,

In design view of the form, create comboboxes for each of the controls that are currently displaying numbers.
Use the Lookup table that corresponds to the control as the Record Source of the comboox.
for example:
For the control Status
The Record Source would be:
tblStatus.StatusID and tblStatus.Status
The width of the StatusID column should be 0"
Store StatusID in the corresponding control on the form StatusID

Here is a link to explain in more detail How to create a Combobox
HTH
nickynoo
Thanks it seems so obvious now. I was really stressing about how I was going to do this, thankyou,
cpetermann
yw.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.