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!

Error after linking subform to form

Status
Not open for further replies.

MarkGibson

Programmer
Feb 15, 2001
24
CA
I get two errors when I try to add new records via a subforms on it:

a) "The value you entered isn't valid for this field. For example, you may have entered text in a numeric field, or a number that is larger than the FieldSize setting permits." This occurs when I type a first character in any visible text field; after I click OK, the character appears. It seems to occur when Access tries to fill in the Long Integer Link field value for AddrClientID (see details below) as it creates a new record.

b) When I try to move to the next record, I am told that the Link field AddrClientID cannot be left blank because it is a required field. In fact I have set the property to be required, because it is the link, and always before Access filled this in automatically. If the field is not required, then the link field is left blank.

(If I type in a record manually in tblAddresses, including an existing OR a non-existent Client ID in the AddrClientID field, when I open the main form (frmMain) I get an error message saying that the expression is too complicated to be calculated...please simplify, and the subform is whited out).

Details:
I have created tblClient with an autonumber key field called ClientID. I have created a form frmMain that has tblClient as its Source Object (I have also tried using Querybuilder, and had "SELECT * FROM tblClients;" as the source).

Onto a Tab Control I have placed a subform named sfrmAddresses, which accesses tblAddresses (autonumber key is AddrID, with a Long Iinteger Link field called AddrClientID). sfrmAddresses has tblAddresses as its Source Object (I have tried the query route here also).

The Master Link field is ClientID and the Child Link field is AddrClientID.

I am perplexed...to say the least! Microsoft KnowledgeBase says nothing on this that I can find.

 
Seems a bit odd, maybe there's some code lurking around somewhere.

Can you e-mail the databse to me ?

jane.crump@essexrivers.nhs.uk

 
I am having almost this exact same problem. I have three subforms on a main form. Here are the form names:

Main Form --> frmStreets
Subform1 ---> subfrmControllerCabinet
Subform2 ---> subfrmDetectors
Subform3 ---> subfrmPhasingAndCoordination

frmStreets, the Main Form, has primary key IntersectionID.
All of the subforms contain fields, fkIntersectionID. The subforms are all linked from IntersectionID to fkIntersectionID.

When adding a new record in frmStreets, immediately after typing the first keystroke into the first text field on the form, I get the error message "Primary Key Cannot Contain A Null Value." I have to acknowledge this pop up box twice and then I am allowed to continue entering data. But now, whenever I move back and forth between the records, I have to deal with the error pop up box telling me that my primary key cannot contain a null value. If I close the form, and open it again, the new record I just entered is still there. There is no problem navigating through existing records, but as soon as I try to create a new one, LOOK OUT. Access throws a fit.

Well I hope you figure this out because I would sure like to know what's happening.
 
Hmm, managed to replicate this problem on a copy of one of my databases and then got rid of it. Check your primary keys on the tables behind the subforms.

Access will update whatever the link field is, if this isn't the primary key then this may well be the problem.

Let me know how you get on !

JAne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top