Results 1 to 7 of 7
  1. #1
    bcz is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    12

    Can't assign a value error on entering data in a subform

    I have Office 2019 on Windows 10. I am pretty much an Access newbie. I have some VBA for some combo boxes, but copied from others - I don't know VBA.



    I have an Access DB with a table for books: tblWork. WorkID is the auto primary key and Title is a required field. There are a bunch of other fields. I have created a form with only tblWork fields - FRM-Work-only. This works perfectly fine. However, I want a form that can be used to enter a new work plus a bunch of other related info from other tables. So I created a form FRM-WorkPlus. In the header of this main form I have only WorkID and Title, and a lookup box to find records. But since there is a lot of stuff I want to include and it won't fit on one screen, I have created a tab control and plan to put subforms into the tabs. For the first one, I have put a copy of FRM-Work-only as a subform. This is almost unchanged, except for some row source info in the cascading combo boxes that are in the form, and the form name. So the properties for the Title text box are the same as in FRM-Work-only, which includes Enabled=Yes and Locked=No.

    The subform works fine when displaying existing records. However, if I try to enter a new record on the main form I have trouble. I can't enter data on the main form because there are other required fields in tblWork. So I go straight to the Title box on the subform. After typing the first character I get the "You can't assign a value to this object" error. If I click ok, it lets me continue to fill in the fields in the subform. However, for one thing, the Title field in the main form remains blank. After entering data, if I go to the first record, then back to the last record, the new record is not there. But when I close the form and look in tblWork, the new record is in fact there.

    How can I avoid the error and have my main/subform accurately reflect newly added records? Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    We need to know more about table structures and relationships and form/subform design as well as the code. Provide your 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
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I'm having a hard time following your scenario...but one question...are the Main Form and Subform based on the same Table?

    Linq .0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    bcz is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    12
    Quote Originally Posted by Missinglinq View Post
    I'm having a hard time following your scenario...but one question...are the Main Form and Subform based on the same Table?

    Linq .0)>
    Yes, both Main and Subform are based on tblWork. I'll attach my database as the previous post suggests, however it may be a few days before I have the time to do so.
    Thanks.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Have you considered using Split form?
    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.

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Main Form and Subform(s) based on the same Table really makes no sense. If you have Controls that need to appear separately, for whatever reason, or too many Controls to appear on a single screen, as in your stated case, you can add a Tabbed Control to your Form and place different Controls on different Pages...there's no need to add a Subform...you can add your Controls directly on the Tabbed Pages.

    Another advantage is that you can reference these Controls in the same way as you would any Control on a single 'page' Form, i.e. Me.ControlName...no need to use the referencing of a Subform Control that many newbies find confusing.

    It's possible, even probable, that you do need to use an actual Main Form/Subform...but it's hard to tell what you mean by

    Quote Originally Posted by bcz
    ...plus a bunch of other related info from other tables...
    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  7. #7
    bcz is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    12
    ReadingList-20200607-forForum.zipI am attaching my DB. I've cleaned out most of my early attempts at tables and forms, although there are a couple forms labeled "subform" that are early attempts.
    I already have forms for each individual table that work. But when I enter a new work in the DB, I would also like to have the option to enter, on the same form, info on related series (basically all tblSeries and tblmmSeriesWork fields), related awards (tblAward and tblmmWorkAward), and related stuff in tblReading. This is in addition to all the fields in tblWork and the associated author and anthology info that I have now in the main form of FRM-WorkPlus. So I thought my only reasonable approach is to use tabs. I didn't know about split forms. I took a quick look...my first impression is, will that work with the tabs for the other stuff with minimal or no scrolling? Maybe Missinglinq's suggestion of splitting the Work controls between on and off the tabs will do what I want. I can try that this weekend, or any other suggestions you may have.
    Thanks for looking at this!

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

Similar Threads

  1. Replies: 1
    Last Post: 06-30-2016, 04:57 PM
  2. I need help with an error made entering data.
    By raycatena in forum Access
    Replies: 7
    Last Post: 06-29-2015, 05:14 PM
  3. Error entering new record on a subform
    By AccessNewb11 in forum Access
    Replies: 1
    Last Post: 07-24-2014, 11:49 AM
  4. Replies: 1
    Last Post: 07-18-2014, 04:11 AM
  5. Replies: 4
    Last Post: 04-07-2011, 03:39 PM

Tags for this Thread

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