Results 1 to 10 of 10

Button to add record from form

  1. #1
    newegyptian is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2019
    Posts
    43

    Button to add record from form

    i have this database with patient data table







    and the drug list table




    and the drugs table that the patient need






    and relation between them





    and drug list form in continious manner






    and patient drugs form in continiuos manner





    and patient data form contain the drug list form and patient drug form which linked to patient id










    i want this button to add record data from the drug list form to new record in patient drug form






    thanks

    can you do it for me

    this is the database link

    https://ufile.io/w3sn7fwl

  2. #2
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,193
    you want an append query with the criteria set to the form/ID.

  3. #3
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    13,910
    Perhaps your table/relationships are incorrect. Normally I would expect

    tblPatient -->tblDrugsForPatient<--tblDrug

    where tblDrugsForPatient is a junction/associative table.

    Also, one would normally see dosage and frequency(medication time(s)) values somewhere in the related processes.

    Good luck with your project.

  4. #4
    newegyptian is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2019
    Posts
    43
    Quote Originally Posted by Homegrownandy View Post
    you want an append query with the criteria set to the form/ID.
    how ? i cant unerstand your point

  5. #5
    newegyptian is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2019
    Posts
    43
    Quote Originally Posted by orange View Post
    Perhaps your table/relationships are incorrect. Normally I would expect

    tblPatient -->tblDrugsForPatient<--tblDrug

    where tblDrugsForPatient is a junction/associative table.

    Also, one would normally see dosage and frequency(medication time(s)) values somewhere in the related processes.

    Good luck with your project.

    can you make it for me
    this is database link

    https://ufile.io/w3sn7fwl



  6. #6
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    13,910
    Attached file Adjusted.zip shows revised tables and relationships.
    I have not looked at your forms.
    You should provide your statement of requirements so readers understand the proposed application.

    Depending on your requirements you may also need info re:
    -specific dosage of each drug for each patient
    -whether or not drug dosage was "taken"
    -....etc

    You should review Many to Many relationships to see how databases accommodate this structure.
    There are many articles in the Planning and Design link in my signature.

    If you look at table design, you'll see that I have an autonumber PK on junction table, and a unique composite index on field combo PatientID +DrugID.

    Good luck with your project.
    Attached Files Attached Files

  7. #7
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    8,258
    orange was first (again) but I'm going to post my version anyway. I also modified the two forms...... this is very similar to oranges's version...

    I added some nav buttons/code and changed some field names/table names..
    Attached Files Attached Files
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  8. #8
    newegyptian is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2019
    Posts
    43
    thanks alot
    @orange
    @ssanfu


    but i just want the code that i should but on this button to copy fields if record in the drugs list form to paste it in patient drug form as a new record


  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    47,476
    Cross post https://access-programmers.co.uk/for...d.php?t=305032

    As asked in other thread: Why not use a combobox to select drug in PatientDrugsF? No VBA needed. Otherwise, use an INSERT action SQL.

    @Orange, PatientDrugsT is the junction table.
    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.

  10. #10
    newegyptian is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2019
    Posts
    43
    Problem solved
    I tried many codes till it work
    I will upload the code and database when i will on desktop
    To help other if have the same problem
    Thanks june7 thanks all

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

Similar Threads

  1. Replies: 5
    Last Post: 02-16-2019, 12:49 PM
  2. Replies: 1
    Last Post: 06-24-2013, 11:31 AM
  3. Add Record Button Form
    By kje7713 in forum Forms
    Replies: 4
    Last Post: 03-11-2013, 01:42 PM
  4. Replies: 2
    Last Post: 05-11-2012, 11:52 AM
  5. Replies: 1
    Last Post: 11-21-2011, 07: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
  •  
Tech Forums: Microsoft Office Forums