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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Odd Error Message 2

Status
Not open for further replies.

jacque427

Technical User
Nov 5, 2003
122
US
Because of help offered here I've fixed a previous problem.
(many thanks!)

But a new one has arose/arisin/come-up within the database.

When adding a record I get an error message saying the record is set read-only. But I have looked at every property setting and can't see where that is set.

The link to see is it at






Knowlegeable enough just to cause serious problems.
 
Hmm, a bit of clairification.

Do I make the *ID in dar_toc and dar_officer autonumber or regular number?



Knowlegeable enough just to cause serious problems.
 
OOp! I got your message now. Have made the changes. :)



Knowlegeable enough just to cause serious problems.
 
On the relationship part..."Go to relationships again, and create relationship between dar_officer and dar, and between dar_toc and sub_dar (again checking "Enforce Referential Integrity")."

What fields should I set a relationship via? My gut instinct is to do it via the primary keys.







Knowlegeable enough just to cause serious problems.
 
Ah! I may not be swift but I am....

I figured out the relationship. In a couple of hours will work on the forms.



Knowlegeable enough just to cause serious problems.
 
dar_toc.tocID and sub_dar.tocID
dar_officer.offID and dar.offID

Primary key on the "1" side and foreign key on the "M" side.

Roy-Vidar
 
Well, I thought the form and sub-form modification would be easy. Just change the controls for the controls, right?

Wrong! Geesh, I have a lot to learn.



Knowlegeable enough just to cause serious problems.
 
Just come back and ask any question.

Thanx for the star!

Easiest for the forms; recreate the thru the wizard, selecting all fields from dar ana all fields from sub_dar except ID.

Roy-Vidar
 
YOu deserve a lot more than a star. E-mail me at jack@runway.net off list if you get a chance.



Knowlegeable enough just to cause serious problems.
 
Now I have a form problem.

I have created an autoform based upon the DAR table and a sub-form within.

I used the Form Wizard, choosing DAR as my table for the data.

Selected all the available fields (from DAR).

Then selected sub_dar and selected everything but the id field.

The form creates nicely, but when I attempt to add data to the sub-form I use the combo-box to choose the toc and the following message pops up. "Index or primary key cannot contain a null value."

I looks like tocid which has a relationship via dar_toc is not updating.







Knowlegeable enough just to cause serious problems.
 
The error message indicates that the primary key in one of the tables does not contain/has not been assigned a value. It must be the sub_dar, cause dar has an AutoNumber id (unless you didn't register a dar record previous to adding a record in sub_dar). The sub_dar primary key (should) now be composite, including both id and (I believe) the datefield. Both must contain a value (In the database I browsed, the date field in sub_dar did not contain a =Date() as default value (but it did in dar) perhaps you should add it in sub_dar too, to ensure a value in the primary key.

The id field should get the id value from the main form/table automaticly (but do check the link parent/child thingie, where both should be "id".

If the tocID thingie is causing a problem, it would more likely produce a "You cannot add or change a record because a related record is required in table 'dar_toc'"

(You have removed/deleted the original toc field?)

Any questions, report back!
Perhaps also upload the current db again?

Regardig your previous post:

Thank you for the kind words, and again for the stars!

Kind words, hearing that ones suggestions/tips sometimes have provided others with better solutions are among the strongest motivations for doing this. Just this week or last week, somenone said a tip from yours truly helped with something she/he had been struggeling with for 6 months. Reading such, is one of the greater rewards!

Also, both providing suggestions/tips and browsing the forums and faq's are great learning experiences for everyone, and also good motivation. So doing this is also partly egoistic - I'm using time on TT to learn more and become a better programmer, instructor and "tipster".

Further I am of the opinion that contact between members outside these forums, might be a bit tricky, cause I make a living out of working with the Office products (since I do support, "teaching", developing etc via e-mail I think the red words just below the preview and submit buttons might apply, at least to my situation). Using time on TT between assignements to "make my brain tick" (or at least try to), I find rewarding, but I'll continue to keep a very strict separation between billable time/clients and TT (regardless of your intentions with providing your e-mail adress).

Just keep on enjoying Access;-)

And yes - until the tables and relationships are supporting the business rules, forget about forms, queries n'reports;-)

Roy-Vidar
 
I did add the =date() to the sub_dar as you suggested and it fixed the 1st problem.

I am now getting the message "You cannot add or change a record because a related record is required in table 'dar_toc'"

In the design view of the dar table I can go to properties and see that the subdatasheet name is [auto]with the master and child link fields blank.

Should this be set to subdatasheet name: dar_toc and the appropriate master and child links?

And I have deleted the form(s) again till the broader problem of the database gets fixed.

---

On the e-mail address, I would like to send you personal thank you note and/or a pound of local roasted coffee (if your a coffee drinker) or a 6 pack of local brewed beer if you would like. Your help has been an invaluable learning tool.




Knowlegeable enough just to cause serious problems.
 
!? I have no idea why that car is in the message. I didn't add any html.



Knowlegeable enough just to cause serious problems.
 
Previous post I stated (You have removed/deleted the original toc field?)

(you didn't have to delete the form(s), we could have amended them - the comment in the bottom of last post was ment "in general" - think the table structure is OK now, sorry to create confusion again:-()

Remove the original toc field in both the dar_sub table and the form (if the forms are gone, the recreate them with the wizard, not the 'Autoform' thingie - I see you've used the datasheet layout for the subform - have you tried the continous forms (in the wizard, it's called tabular)?).

Crate a new combobox in sub_dar (FORM - tablelookups are not exactly encouraged) to look up the corresponding descriptions in dar_toc, assure the value is stored in (bound to) the tocid field in the subforms recordsource.

You might then delete the original tocid control on the form, and use only the combo.

If you're unfamiliar with creating comboboxes;
Design view of the form, be sure to have selected/activated the subform. Select the combobox button to create a new combobox thru the wizard. Place the combo in the subform detail section. (if the wizard doesn't start, delete the combo, hit the Wand button on the toolbox (button number 2 on that toolbar) to activate it)

Select "I want the combo box too..." then next
Select "dar_toc" then next
Select both "tocid" and "description" then next
Let the key column be hidden (as suggested by the wizard) then next
AND - select tocid to "Store that value..." press finish

You might wan't to consider the same for the dar offid field.

Link parent/child in the tables - don't know what others think, but I don't like it (nice symbol though, took me a while to figure it out;-)). I often set them to [none]. Now we both learned that the word Auto with brackets around gives [Auto]. Nice one!

Now - where the link parent/child is important, is in the form/sub form, where it must contain the primary key/foreign key (here, I believe id in both). As long as the table design is in order, this is done by the wizard.

Preciate your intention, consider your tokens received! (Sipping a rather nice cup of coffee right now;-))

Roy-Vidar
 
Hmm, something appears to be wrong.

I tried entering data into DAR via the table, and I get the "You cannot add or change a record because a related record is required in table 'dar_officer'" when I go to the next line.

Though I can enter data from the dar_officer table via the little + at the left edge of the table.

This seems as if I am spinning my wheels. Please feel free to tell me so and I'll pursue another angle. (like pay someone to make this dang thing for me!)

I'm at work right now so can't upload what I've done to my home site. I'll be home in about 3 or so hours and will do it then.

I do have e-mail though and can e-mail it somewhere if you want to look at it.



 
OK!

Thingie with 1:M relationship. The 1-side needs to be populated with correct records before you add anything on the M-side. Translated to your system, you need to have registrated the officers prior to adding them to a dar record. Have you registrated the officers? (Likevise with registrating TOC before adding them to the sub_dar table/subform.)

So when you have registrated your officers in the officer table, you can enter a record in the dar table, using a value from the dar_officer (1, 2, 3... or whatever is registrated in the offid field) in the dar.offid field. This is what we want to hide from the users with using the previously mentioned comboboxes.

And again, you have deleted the "Name" fields in both tables?

Again, don't wanna use e-mail, but uppload the database and give notice here, I'll comment.

Roy-Vidar
 
Ok, the database is at

I've double checked and there is no "name" or I believe any of the reserved names used.

I've added a name to both dar_officer and dar_toc. I take it by registering you mean putting someting in the field.



Knowlegeable enough just to cause serious problems.
 
Quicky:
Remove dar.offname - solved thru the relationship with dar_officer

dar_sub.writer, since no sample data, i don't know what you use this field for.

Register values in dar_officer and dar_toc so that
1 - I can see a litle about what you wan't to achieve
2 - you can register some testvalues in dar/sub_dar

Roy-Vidar
 
Made the changes, added some values and re-uploaded it to the same url. (hmm, I am beginning to think this is somewhat more complicated than html.)

I am going to wait till you tell me to make some new forms.
 
To me this structure looks fine!

Just a suggestion. If you're going to have some meaningfull relationship with the occuredtime field in sub_dar (thinking of for instance being able to query if a particular time of day has more occurances of some type of reportable task, consider changing it to a date/time field, and perhaps also add a default value to it (=time()). 'nother suggestion is to use input masks on both time and datefields, so that the users might get some help in typing correct entries.

Now create the form with subform - you can then add values to both dar and sub_dar, just using the numeric values from those tables.

Next step then, is to create the combos (as mentioned earlyer, just follow previous description)

BTW - enjoing both coffee and ... at present, so any typos...;-)

Roy-Vidar
 
Ok, I believe I may have something wrong.

I've re-uploaded the db with the forms I made using the wizard and associated combo-boxes.

When filling out the form I get various error messages.

Oh and the time(s) are not really relevent. But thanks for the suggestion. I'm more concerned with the toc field and doing searchs on that.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top