Results 1 to 3 of 3
  1. #1
    Tuckejam is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2020
    Posts
    168

    adding records using referenced or linked information? (maybe a bad title)

    I am trying to replicate a NOTES feature that we use in the company DB at my work.



    We have Jobs that have JOBNAME and JOBNUMBER, and there is a JOBNOTES form for storing notes

    The Main JOBNOTES form has two smaller Subforms
    The top subform is where you would enter the new note and click add
    and the bottom subform is the history of all of the previous notes for that job that you can scroll through

    and all of the notes for all jobs are saved in the same tblProjectNotes
    (I took the image below from the work DB hoping someone here can help me figure out how it works)

    Click image for larger version. 

Name:	PTNotesExample.PNG 
Views:	12 
Size:	285.1 KB 
ID:	44501

    I cant figure out how it is automatically designating the JOBNUMBER or PROJECTID when saving the note by clicking ADD.

    I built my own (much less pretty) version at home, and the lower part on mine works fine,
    I just used a qry that references the JOB/Chapter that the form i showing and it only displays notes for referenced information

    but I cant get the ADD notes part to work.
    any way I try to reference or pull the information for the job(chapter) that I am logged into causes a problem when trying to "ADD" the note

    I get and error that states

    "You cannot add or change a record because a related record is required in the table 'tbl_Chapters'

    See image below

    Click image for larger version. 

Name:	OHC Notes.PNG 
Views:	12 
Size:	47.4 KB 
ID:	44502

    Any thoughts or ideas would be greatly appreciated.

    THanks

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    If that was mine, then I would have an autonumber ID that identifies a Jobname and JobNumber, but it really depends on your data structure.? If te jobnumber was unique, then it might be that.
    The table where the job is held would be the parent and the notes table the child table.

    You cannot add a child record before you add a Parent record.? In your case it appears to be tblChapters record?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Is the frm_ChapterNotesNew_sfrm linked to the main form via the master\child field ChapterName. If you set it as Data Entry=Yes and link it that should be all that is needed (you shouldn't need a textbox for the author as it should be coming from the logged on user on the main switchboard).

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 0
    Last Post: 10-30-2019, 10:02 PM
  2. Replies: 5
    Last Post: 10-20-2019, 05:51 PM
  3. Replies: 4
    Last Post: 01-16-2019, 03:38 AM
  4. Replies: 3
    Last Post: 07-05-2018, 10:55 AM
  5. Replies: 20
    Last Post: 05-24-2010, 06:31 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