Results 1 to 15 of 15
  1. #1
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276

    Field Cannot be updated - Error

    I created a form (Salery) and subform (Employee being the subform) and when I try to enter information into the Employee subform, I get the error "field cannot be updated." However, after I click "ok", I can then enter information into the subform. How do I get rid of that error message?




    Name Of Query: Query1
    Query on Salery Form
    SELECT Company.ComapnyName, Company.CoId, Company.Dept, Company.Catagory, Company.CoAttach, Company.[NIC No]
    FROM Company
    ORDER BY Company.ComapnyName;

    Name Of Query: Main Salery Query
    Query on Employee subform
    SELECT Purchases.PurTransId, Purchases.[Purchase Date], Purchases.[Pur Seller], Purchases.[Purchased from Company], Purchases.Warehouse, Purchases.[Purchase Description], Purchases.[Salery Month], Purchases.[Purchase Qty], Purchases.[Purchase Units], Purchases.[Purchase Price], [Purchase Price]*[Purchase Qty] AS totlAmt, Purchases.[Purchase Type], Purchases.purattach, Purchases.[Pur Entry Type], Purchases.[Pur User], Purchases.[EntryPLogin By], Purchases.[Pur Varification], Purchases.[Purchase Remarks], Purchases.CatPurchase, Purchases.PurCompanyName, Purchases.[Payment Made], Purchases.[Invoice #], Purchases.[Truck #], Purchases.[Payment Type], Purchases.[Supplier Bank], Purchases.[Delivered To Party], Purchases.PurCoId
    FROM Purchases
    WHERE (((Purchases.CatPurchase)="KatSalery"));

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    How are main and sub forms related? What are the Master/Child properties of the subform container set to?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    Click image for larger version. 

Name:	Property Sheet.jpg 
Views:	23 
Size:	85.1 KB 
ID:	16813

    Mater Fields: CoId;ComapnyName
    Child Fields: PurCoId;PurCompanyName

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Why include the name fields in the links? The ID fields should be enough.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    Even If I remove name fields still I am getting error

  6. #6
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    Query1


    Click image for larger version. 

Name:	Query1.jpg 
Views:	23 
Size:	106.1 KB 
ID:	16814


    Main Salery Querry


    Click image for larger version. 

Name:	Main Salery Querry.jpg 
Views:	23 
Size:	54.7 KB 
ID:	16815

  7. #7
    A S MANN is offline Advanced System Analyst
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    India
    Posts
    161
    What is relationship between these two table?
    Try use Company table as Source for form and Purchase Table as Child as sub form.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    You have CompanyName set as primary key. Should be CoID.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    Have changed CoID as primary key.
    problem still not solved

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Do you have any VBA code in these forms? It may be that code that is causing the error, and not the forms themselves.

    John

  12. #12
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    June I have attached DB for analysis
    Problem is in Salery Data Entry Form
    Whereas Salery Payments Entry Form is working fine

    Final Sample.zip

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    The db provided still has company name as primary key and compound links on subform. DB is set up to save company name to related tables and should be saving only the company ID. Example: Purchases table has a text field PurCompanyName and a number field for PurCoID. Remove PurCompanyName field. Fix or remove the link in the Relationships window. Fix the form/subform links.

    I don't understand the data structure. Salaries are in Purchases?

    There is no [Salery Data Entry Form], there is [Salery Entry Form] and [Salery]. Appears to be two sets of form/subform.

    Fix and clean up db then post for analysis if you need more help.

    I see numerous misspellings in the db (Salary is one).
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  14. #14
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    Found it. On the sub-form "Salary Subform", you have the default value for the "Total Amount" control set to 0. In the query, "Total Amount" is a calculated field, and cannot be updated, which is what the default value setting tries to do when it creates a new record.

    Delete the default value setting for that form control, and the error goes away.

    There are other issues with this database, but the default value was the cause for the error.

    John

  15. #15
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    Thank u John
    problem solved.

    Yes there are numerous issues with this DB. But as long as its doing my job its fine.
    its like asking a kindergarten student to write the thesis.

    I studied computers in 1983. when we used to have apple IIE. after that what I did, did it on my own picking something from here and some thing from there.
    By profession am not into computers, only do it for my passion. Regarding spelling mistakes as june pointed out. English is not my language, I believe as long as the communication is done or is understood. all is ok.


    thx once again to u and june for the help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 04-06-2014, 10:01 AM
  2. Date field updated when box checked
    By Sienna in forum Forms
    Replies: 6
    Last Post: 03-06-2014, 11:57 AM
  3. Error # 3164 "field cannot be updated"
    By bbrazeau in forum Access
    Replies: 3
    Last Post: 08-29-2013, 01:18 PM
  4. Replies: 3
    Last Post: 05-09-2013, 09:17 AM
  5. Deleting values after a field is updated
    By mwhcrew in forum Forms
    Replies: 3
    Last Post: 08-16-2010, 02:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums