Results 1 to 11 of 11
  1. #1
    lukasz is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2018
    Posts
    5

    Form that add multiple records + Add new record with prefilled values from last record


    /EDIT: I'm medic practitioner and this is a feature I need to add to my existing base I work with, but a) there are datas of my real patients b) it's in polish language, so I build this "example base" to catch the mechanism.
    /EDIT2: Now the base is attached to the post
    Hi there!
    I have some specific problem and im looking for solvation quite a while, unfortunately I dont know VBA, but maybe it's possible to solve it without coding?
    So I have 3 tables:
    1. MedicationsList (just simple list)
    2. PatiensList (as above)
    and my destination table:
    3. MedicationsSchedule, containing: Person, TypeOfDrug (taken as combolist from above tables), Dosage (I fill it manually), DateOfDosage (the date when the patient should take/inject the medication).
    My problem is, my patients take few drugs in the same time, but in different time intervals and adding the records manually is time consuming, so I imagined the form (frmMedicationSchedule), where I can choose patient, drug, dosage (it would be perfect if those fields can be prefilled with fields from last record of the table, which I tried unsuccessfully manipulating with Defaults and Fetch Defaults), but in addition to that - form should allow me to fill DateOfFirstDosage, then number of dosages (how many times patients should take the drug) and intervals in days (how often should patients take the drug). Example - I fill the form with: Person: Mr 1, TypeOfdrug: Drug 1, Dosage: 2 tablets, DateOfFirstDosage: 01.08.2018, Number of dosages: 4 and Interval (in days):3, and after some kind of macro connected to clicking button (I suppose), it would add 4 records to the table with different dates (01.08, 04.08, 07.08, 10.08).
    I tried to do the default values in new record, which would significantly speed up my work, but can't do working defaults with last record values.
    Anyone knows how to do something like that? I attach screenshot of all tables, relations and form Click image for larger version. 

Name:	all.jpg 
Views:	21 
Size:	107.4 KB 
ID:	34857
    and if you want to see the base itself - it's attached.
    Thanks in advance!
    Lukasz
    Attached Files Attached Files
    Last edited by lukasz; 07-25-2018 at 11:04 AM.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Is this a homework or academic exercise? In many situations where Patient(s) is given a PrescribedDrug, there are more checks and balances concerning the Patient, the drug, the dosage and the Time involved. Seems you could add records for any date you choose without any Check/Balance.

    If you want to find an existing record, then do some calculation and add a new record(s), you might research Subqueries by Allen Browne.

    Good luck with your project and welcome to the forum.

  3. #3
    lukasz is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2018
    Posts
    5
    I'm medic practitioner and this is a feature I need to add to my existing base I work with, but a) there are datas of my real patients b) it's in polish language, so I build this "example base" to catch the mechanism, so I could add actual feature to my real base Im adding everything there myself (this feat would be used mainly for hormones replacement therapy) so I really understand all the dangers coming with prescribed drugs ) Ok, i'll try to do the research then and looking forward for some more clues from you guys,
    thanks and great to be here
    Lukasz

  4. #4
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    I believe the DB you posted on Google is corrupt.
    You should compact/repair, then zip and post to this forum.

  5. #5
    lukasz is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2018
    Posts
    5
    Thanks Davegri! Just did it and this way it's small enough to attach to the post, perfect
    Lukasz

  6. #6
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    it's small enough to attach to the post,
    Nothing attached...

  7. #7
    lukasz is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2018
    Posts
    5
    Quote Originally Posted by davegri View Post
    [COLOR=#333333]
    Nothing attached...
    Sorry, I've updated the first post with attached file

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    @davegri

    I think OP has updated the database in post#1 -- I can open it AC2016.

    Sure--just as I find it and test it ---lukasz says same thing in post#7

  9. #9
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    Take a look. Replaced your form and added a subform.
    Automatically adds records for the interval of days specified.
    Has lookup combobox in header of main form to find patient.
    Added query to act as recordsource for subform.

    You will probably want to add code to check for presence of required fields before hitting button to add drug.
    Last edited by davegri; 07-25-2018 at 03:37 PM. Reason: more info

  10. #10
    lukasz is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2018
    Posts
    5
    That probably be exactly what I need, but unfortunately, there's an error reported:Click image for larger version. 

Name:	err1.jpg 
Views:	13 
Size:	45.0 KB 
ID:	34880Click image for larger version. 

Name:	err2.jpg 
Views:	14 
Size:	88.0 KB 
ID:	34881
    Lukasz

  11. #11
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    I set it up for an American date format. Perhaps someone else here can help with Polish date...

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

Similar Threads

  1. Replies: 10
    Last Post: 09-20-2016, 03:25 PM
  2. Replies: 5
    Last Post: 09-29-2015, 11:08 AM
  3. Updating Multiple Record Form Based on Record Count
    By William McKinley in forum Forms
    Replies: 2
    Last Post: 12-31-2014, 12:45 PM
  4. Replies: 6
    Last Post: 08-30-2012, 06:23 PM
  5. Replies: 12
    Last Post: 12-01-2011, 10:28 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