Linking Tabs

B

Bill

Ok. So I have a form with 7 tabs. The way I designed this was that each tab
contains a form all linked to the same table (datalink). When I input on the
header and then clink to the first tab all is fine. When I click to the 2nd
tab I get the error "The changes you requested to the table were not
successful because they would create duplicate values in teh index, primary
key, or relationship. Change the data in teh field or fields that contact
duplicate data, remove the index or redefine the index to permit duplicate
entries and try again".

The sub forms are all linked thru a field called "ReportID". This is a
unique field which is bases on a text and autonumber to generate a number
format of 08-001 etc. All the tabs must be linked to the reportid to create
a single report. If I allow duplicates I get many entries on my datalink
table and they do not all come together. Very strange and I really need
help. Thx.
 
T

tina

a tabpage in a tab control can't be "linked" to a table. a form also isn't
"linked" to a table; it can be *bound* to a table or query, by putting the
table or query name in the form's RecordSource property - or it can be an
unbound form, with nothing in the RecordSource property. (and no, i'm not
picking nits over word usage; "linking" has very specific meanings in
Access, depending on the context it's used in, so using it in the wrong
context can cause a lot of confusion.)

from your description, it sounds like you have the mainform bound to the
same table that all of the subforms are bound to. my first question is: why
have you bound the same table to a form and its' multiple subforms? if we
understand what you're trying to accomplish, someone may be able to offer a
better alternative setup.

hth
 
B

Bill

Thanks Tina. I'm a novice user that has built a DB for my own use. I'm sure
I will continue to screw up the vocab as I go. :)

This form is used to gather facts about an incident (much like a police
report). The form takes in a lot of information including a narrative and
places it into the table. The table is large and has several columns
(probably about 40 or so). I used the tabs to break out the sections of the
report to complete just to make it easier for the user. Then I have a PDF
print command that I use to print the report. It was working just fine, then
I added a text + number autonumber field using a script and I think I changed
a field. Now when the user complete the tabs, each tab creates a new line
item in the table as the autonumber field is set to allow duplicates. If I
change it to not allowing duplicates, the form does not let the user enter
anything into any of the tabs.

I hope this helps a littel more.

Thx

Bill
 
T

tina

comments inline.

Bill said:
Thanks Tina. I'm a novice user that has built a DB for my own use. I'm sure
I will continue to screw up the vocab as I go. :)

as long as you don't mind gentle correction... ;)
This form is used to gather facts about an incident (much like a police
report). The form takes in a lot of information including a narrative and
places it into the table. The table is large and has several columns
(probably about 40 or so). I used the tabs to break out the sections of the
report to complete just to make it easier for the user.

okay, don't use subforms, you don't need them. if all the data is stored in
a single table, then make that table the RecordSource of your one form. on
that form, use the tab pages of a tab control to provide additional "real
estate" for the controls bound to your table fields, since there are so
many. one table, one data entry form - that should take care of your
problem.
Then I have a PDF
print command that I use to print the report. It was working just fine, then
I added a text + number autonumber field using a script and I think I changed
a field.

by autonumber field, i assume you mean a field that you enter a value in
automatically, rather than the user entering it manually. the term
Autonumber refers to a specific data type of a field in a table; an
Autonumber value is assigned to each new record by Access, and the value is
always a number (Long Integer).

a field the combines a number with text is always a Text data type field.
and btw, combining values and then storing the result in a table field is
generally a no-no. store the values singly in their own fields, and
concatenate as needed at the query/form/report level.
Now when the user complete the tabs, each tab creates a new line
item in the table as the autonumber field is set to allow duplicates. If I
change it to not allowing duplicates, the form does not let the user enter
anything into any of the tabs.

I hope this helps a littel more.

yes, all that was helpful; i hope my answers were too. :)
note that forty fields is a bit high for a normalized table; anything over
about 20-25 fields, i'd say, deserves another look to make sure relational
design principles are being followed. suggest you do that. if you'd like a
review of your table design here in the newsgroups, suggest you post to the
..tablesdbdesign ng. post the table name, followed by the field names, noting
the primary key field, foreign key fields, and explaining the data stored in
fields that don't have a clear - to us - name (for instance, FirstName is
pretty clear - well, probably - but TCAR is ???). an easy to follow
table/fields list usually looks like:

TableName
FieldName (primary key)
FieldName (this field is for blah, blah, blah)
FieldName
FieldName (foreign key from AnotherTableName)
FieldName

a description of your subject (in Access, each table should be about one
subject, and the table fields store data that describes the subject) would
also be helpful.

hth
 

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

Top