Results 1 to 7 of 7
  1. #1
    vikghai is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    3

    Inconsistent results.. please help!


    Hello

    I am working with a database where a subform does not save the child link. I have stripped the database of everything except the main form and subform, and I still get the same error. Sometimes the subform will save, and sometimes it doesn't (it appears that it will save only on the first attempt...).

    If you can have a look it would be a great help. The form (frmarticles) contains the subform (subfrmArticlesAuthorship). When I select the author and then proceed to fill in the data in the main form, when I go to the next record and then back, the data in the subform disappears.

    Any reasons why this is happening?

    Thank you
    Attached Files Attached Files

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I would use some VBA code to add records to tblArticlesAuthorship. The link between Master and Child fields will only be useful if there is already a value in the fields. You will need to include authorId to the new record in tblArticlesAuthorship.

  3. #3
    vikghai is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    3
    Thank you so much for the reply.

    I am sorry but I am not too familiar with VBA coding. Can you point me to any sources so I can see a template of what you are suggesting?

    Thanks again!

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I'm not following your post. But I do notice
    there is no PK on tblArticlesAuthorship
    and ArticleId and Authorid in that table are not required fields.

    Your Main form is linked to your subform 1 to Many.
    You must have a record in your MainForm befoe you can add a child record in the subform.

    Update: I see there have been 2 posts since I read it and started to respond.

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I do not see a need for table tblArticlesAuthorship. It is acting as a junction table but I do not see a need for it. I would add a column to tblArticles to be a Foreign Key for CV. Simply, store the PK from tblFaculty in tblArticlesAuthorship.

    If you want to have a Main form/Subform, base your main form on tblFaculty. Your subform can display the many records in tblArticlesAuthorship. Doesn't solve the "adding records" thing but it will simplify the task.

  6. #6
    vikghai is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    3
    Thanks everyone for your input

    1)I have this junction table as I have a many to many relationship between authorId and articleID
    2) It looks like filling out the main form before the subform does the trick (without having to make anything required or adding a PK to the table)

    I can move the subform so its at the bottom of the mainform, that way the user will hopefully not fill it out until they have filled out the subform. Is there any other more eloquent solution?

    Thanks!

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I suggest you concentrate on creating forms to enter data before you worry about viewing the data. Here is an example that creates a new record in the junction table. It is only an example. You will have to adjust it to suit your application.

    The example is a form that views the existing records that represent articles. The user interacts with the form to create a new record in the junction table. This is only to provide you with an idea on how to approach the task of creating a record in a junction table. I can't imagine this form, by itself, would be a practical solution.
    Attached Files Attached Files

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

Similar Threads

  1. Between And operator gives inconsistent result
    By Reaper in forum Programming
    Replies: 6
    Last Post: 02-09-2013, 09:46 AM
  2. Replies: 1
    Last Post: 09-01-2012, 06:58 AM
  3. Inconsistent Code Execution
    By Paul H in forum Forms
    Replies: 2
    Last Post: 09-19-2011, 10:06 AM
  4. Inconsistent??
    By bginhb in forum Programming
    Replies: 3
    Last Post: 09-07-2011, 03:10 PM
  5. Inconsistent Query Error...
    By DHavokD in forum Queries
    Replies: 8
    Last Post: 06-11-2009, 09:58 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