Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Bajaz001 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2011
    Posts
    17

    Copying tables


    Two simple questions:
    1. How to copy table after update (docmd.object copy)?
    2. How to do this after the table is updated trought form?


    And becouse I'm dumbass I need code for this

    TY

  2. #2
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    To where do you wan to copy the object?

    I am really curious, why do you need to copy a table? This is not normally done in production.

  3. #3
    Bajaz001 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2011
    Posts
    17
    Quote Originally Posted by HiTechCoach View Post
    To where do you wan to copy the object?

    I am really curious, why do you need to copy a table? This is not normally done in production.
    To same database. I have problem with db, becouse i need identical data in this table but the other data is different.

    Same customer have separated bills.

    This thread explains my idea
    https://www.accessforums.net/forms/i...ata-11851.html

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by Bajaz001 View Post
    And becouse I'm dumbass I need code for this

    TY
    ummm...I don't that'll get ya very many more customers, sir.

  5. #5
    Bajaz001 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2011
    Posts
    17
    Quote Originally Posted by ajetrumpet View Post
    ummm...I don't that'll get ya very many more customers, sir.
    OK, i'll try to explain.

    I need separate subdatabase.

    Same structure, same (customers) but other tables (same data type) but other data.

    1. Customer - Bill - Items (custom items)
    2. Customer (same as above) - Bill (new ID, from zero) - Item (ONE item)

    Simply I want practically the same database without entering same CUSTOMERS in second thable.

  6. #6
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    I agree with Adam that probably really have no need to duplicate the tables.

    What you are wanting to do it normally done in spreadsheets. It is not done in relational databases. It would defeat the purpose of a well designed relational database. When table structure are the same then they should be in the same table. The data does not matter. The data could be for one customer to 100,000+ customers, it will still be in the same table if the table structures would be basically identical. If you want it to appear as multiple tables to the end user then you use queries to filter the data. It can appear to the end user that there are many tables, but in reality it is just one.

    If it were mine, I would avoid copying tables. It can get really messy really fast once you start. If your really decide to go against the wisdom of the Database Masters and still do it, make sure you do a backup or two before you run the copy table routine. Don't forget you will need to write VBA code to create all the relationship to enforce referential integrity.

  7. #7
    Bajaz001 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2011
    Posts
    17
    Quote Originally Posted by HiTechCoach View Post
    I agree with Adam that probably really have no need to duplicate the tables.

    What you are wanting to do it normally done in spreadsheets. It is not done in relational databases. It would defeat the purpose of a well designed relational database. When table structure are the same then they should be in the same table. The data does not matter. The data could be for one customer to 100,000+ customers, it will still be in the same table if the table structures would be basically identical. If you want it to appear as multiple tables to the end user then you use queries to filter the data. It can appear to the end user that there are many tables, but in reality it is just one.

    If it were mine, I would avoid copying tables. It can get really messy really fast once you start. If your really decide to go against the wisdom of the Database Masters and still do it, make sure you do a backup or two before you run the copy table routine. Don't forget you will need to write VBA code to create all the relationship to enforce referential integrity.
    With my current knowledge it mission imposible, also i would have ~100 users (not big deal).

    If anyone can simply write few lines it'll make my life better

    I've got no time left, so any simple solution will be ok.

    This is my DB attached, so feel free to recommend a solution.

  8. #8
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    After looking at your attachment I recogize this database from the same question in your other post HERE

    I would just add an additional field to the table Artikli to idenfity the group/category or whatever you want to call it. This new field would contain data like usluge.

  9. #9
    Bajaz001 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2011
    Posts
    17
    Quote Originally Posted by HiTechCoach View Post
    After looking at your attachment I recogize this database from the same question in your other post HERE

    I would just add an additional field to the table Artikli to idenfity the group/category or whatever you want to call it. This new field would contain data like usluge.
    OK, if i add this additional field, will i have new RAČUN from zero. Becouse i want this (if i didn't explain this).

    User 1 - Račun 1 - Stavka 1,2,3,4....
    User 1 - Račun 1 / usluga - Stavka 1 (usluga)
    User 1 - Račun 2 - Stavke 2,34,5,...
    User 1 - Račun 2 / Usluga - Stavka 1 (usluga)

    That mean different form for USLUGE, (different contorl source for ARTIKLI), and RAČUN must have ID increment. With your solutuion i have RAČUN & RAČUN USLUGE with different ID or?

  10. #10
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    I am not understnd what you are needing or doing.

    From the best I can figure out it seams like you may be needing a custom auto incrementing field. You can use DMax() +1 to calculate the next number.

  11. #11
    Bajaz001 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2011
    Posts
    17
    Quote Originally Posted by HiTechCoach View Post
    I am not understnd what you are needing or doing.

    From the best I can figure out it seams like you may be needing a custom auto incrementing field. You can use DMax() +1 to calculate the next number.
    And there is problem again. How to change this DMax () + 1.

    And also (i left some test data in db), how to change ID of RAČUN when is one/more record deleted (also in ARTIKLI/KORISNICI). For example, i have 3 users User 1, User 2, User 3, and i delete User 2, new next user is User 4 (how to add this new to 2, or simply how to User 3 marge to User 2.

    EDIT:

    How to simply have 2 subdatabases:
    1. Korisnici - Račun - Stavke - Artikli
    2. Korisnici_us - Račun_us - Savke_us - Artikli_us

    Where Korisnici & Korisnici_us are the same, i.e. Korisnici FORM update Korisnici and Korisnici_us tables?

  12. #12
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    Will all users need access to the same backend?

    Maybe you need to give each user their own separate back end?

    If you have not split your database then see there articles on Split Database (Click Here)

  13. #13
    Bajaz001 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2011
    Posts
    17
    Quote Originally Posted by HiTechCoach View Post
    Will all users need access to the same backend?

    Maybe you need to give each user their own separate back end?

    If you have not split your database then see there articles on Split Database (Click Here)
    Not Users as Users, it'll be one Admin/User. By users i meant, users as data in table sorry.

  14. #14
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    Since I don't have a clue about what your datasbes is trying to do I don't don't know how to help you do this proeprly.

    If you actaully have ~100 user then you would need to copy the set of tables ~100 times. If you cwna to copy the table then I would look inot separate back ends. I still thin kthe correct solutuion is using a single set of tables.

  15. #15
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    If you really want to copy the tables then I woudl use DAO code to create each new set of tables and create the correct relationshsips. See: DAO Programming Code Examples

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Dlookup List for copying
    By asmith in forum Programming
    Replies: 5
    Last Post: 10-08-2010, 08:14 PM
  2. Copying and pasting
    By wthoffman in forum Access
    Replies: 1
    Last Post: 04-14-2010, 04:12 AM
  3. Keep From Copying Database
    By jmyersnc in forum Programming
    Replies: 2
    Last Post: 02-07-2010, 07:44 PM
  4. Copying selected fields to a new record
    By Lyle Bitikofer in forum Forms
    Replies: 0
    Last Post: 12-13-2009, 04:01 PM
  5. Copying into empty fields until...
    By cochi30 in forum Programming
    Replies: 8
    Last Post: 06-07-2009, 07:38 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