Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26
  1. #16
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Try the attached db. Post back with any questions.
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  2. #17
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Now that I've seen your tables I see that it's not that simple. However, you can have this query
    Code:
    SELECT PAYROLL.FULL_NAME, PAYROLL.BANK, PAYROLL.ACCOUNT_No, PAYROLL.POSITION, 
    PAYROLL.BASIC_SALARY, PAYROLL.SSF, PAYROLL.TAX, PAYROLL.NET_SALARY, PAYROLL.PAYROLL_MONTH
    FROM PAYROLL
    WHERE (((PAYROLL.PAYROLL_MONTH)=[Enter Month To Copy As 01/2023]));
    which would be called by this query
    Code:
    INSERT INTO PAYROLL (FULL_NAME, BANK, ACCOUNT_No, [POSITION], BASIC_SALARY, SSF, TAX, NET_SALARY, PAYROLL_MONTH)
    SELECT qryCopyMonthData.FULL_NAME, qryCopyMonthData.BANK, qryCopyMonthData.ACCOUNT_No, qryCopyMonthData.POSITION, 
    qryCopyMonthData.BASIC_SALARY, qryCopyMonthData.SSF, qryCopyMonthData.TAX, qryCopyMonthData.NET_SALARY, 
    Month(DateAdd("m",1,[PAYROLL_MONTH])) & "/" & Year([PAYROLL_MONTH]) AS AppendMonth
    FROM qryCopyMonthData;
    EDIT - Forgot to mention that select query would have to be named
    qryCopyMonthData, otherwise change this name to your select query name in the append query.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #18
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Another edit: @Bob, not trying to butt in. Didn't see your post in spite of the delay and that's because of antiquated forum software I guess.
    I also didn't even look at the form in OP's db, so now I see that rather than using a parameter prompt, a form field reference would be better.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #19
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Quote Originally Posted by Bob Fitz View Post
    Try the attached db. Post back with any questions.
    Thanks
    Let me try and get back to you

  5. #20
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Quote Originally Posted by Micron View Post
    Now that I've seen your tables I see that it's not that simple. However, you can have this query
    Code:
    SELECT PAYROLL.FULL_NAME, PAYROLL.BANK, PAYROLL.ACCOUNT_No, PAYROLL.POSITION, 
    PAYROLL.BASIC_SALARY, PAYROLL.SSF, PAYROLL.TAX, PAYROLL.NET_SALARY, PAYROLL.PAYROLL_MONTH
    FROM PAYROLL
    WHERE (((PAYROLL.PAYROLL_MONTH)=[Enter Month To Copy As 01/2023]));
    which would be called by this query
    Code:
    INSERT INTO PAYROLL (FULL_NAME, BANK, ACCOUNT_No, [POSITION], BASIC_SALARY, SSF, TAX, NET_SALARY, PAYROLL_MONTH)
    SELECT qryCopyMonthData.FULL_NAME, qryCopyMonthData.BANK, qryCopyMonthData.ACCOUNT_No, qryCopyMonthData.POSITION, 
    qryCopyMonthData.BASIC_SALARY, qryCopyMonthData.SSF, qryCopyMonthData.TAX, qryCopyMonthData.NET_SALARY, 
    Month(DateAdd("m",1,[PAYROLL_MONTH])) & "/" & Year([PAYROLL_MONTH]) AS AppendMonth
    FROM qryCopyMonthData;
    EDIT - Forgot to mention that select query would have to be named
    qryCopyMonthData, otherwise change this name to your select query name in the append query.
    Thanks
    We give you guys feedback soon

  6. #21
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Quote Originally Posted by Micron View Post
    Another edit: @Bob, not trying to butt in. Didn't see your post in spite of the delay and that's because of antiquated forum software I guess.
    I also didn't even look at the form in OP's db, so now I see that rather than using a parameter prompt, a form field reference would be better.
    No problem
    The db that I last posted uses recordsets to get the job done. It works, I think but I'm sure the OP will advise. I did originally try using an append query but ran into problems. I suspect that running queries might be faster than using recordsets although I don't know by how much. With a small number of employees the speed might not matter.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #22
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    First of all, i will like to appreciate you all for such a great work done. Especially to those who took time to type codes and also check my db to assist me. I tested the db that i received from here and it worked perfectly the way i wanted it.

    I went further to add more fields which i will need for my system and followed similar procedure in the db to this new one i created.

    But for some reasons, it is giving me an error which i find difficult to understand.

    I Think it may need a little touch and will be glad if it could be checked for me.

    Thanks to you all for such an amzing work so far
    Attached Files Attached Files

  8. #23
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Quote Originally Posted by Emmanuel View Post
    First of all, i will like to appreciate you all for such a great work done. Especially to those who took time to type codes and also check my db to assist me. I tested the db that i received from here and it worked perfectly the way i wanted it.

    I went further to add more fields which i will need for my system and followed similar procedure in the db to this new one i created.

    But for some reasons, it is giving me an error which i find difficult to understand.

    I Think it may need a little touch and will be glad if it could be checked for me.

    Thanks to you all for such an amzing work so far
    Try the attached db:
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  9. #24
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Quote Originally Posted by Bob Fitz View Post
    Try the attached db:
    Wow. It worked perfectly and I have been able to apply the concept of your db to produce other results to suit my needs.

    Thanks so much for your time and efforts.

    And to all others who made time to assist me, I do appreciate

  10. #25
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Quote Originally Posted by Emmanuel View Post
    Wow. It worked perfectly and I have been able to apply the concept of your db to produce other results to suit my needs.

    Thanks so much for your time and efforts.

    And to all others who made time to assist me, I do appreciate
    I'm glad that you have a solution and have gained some knowledge.
    BTW I'm not a fan of calculated fields in tables. I prefer NOT to store calculations in tables but have them in queries and redo the calculation whenever and wherever it is required.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  11. #26
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Quote Originally Posted by Bob Fitz View Post
    I'm glad that you have a solution and have gained some knowledge.
    BTW I'm not a fan of calculated fields in tables. I prefer NOT to store calculations in tables but have them in queries and redo the calculation whenever and wherever it is required.
    Noted
    Will give that a try one of these days and see how it goes

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

Similar Threads

  1. copy data from one table to another
    By frankmanl in forum Access
    Replies: 9
    Last Post: 01-22-2023, 01:57 PM
  2. Copy data from one table to another
    By sdel_nevo in forum Queries
    Replies: 2
    Last Post: 06-15-2017, 07:43 AM
  3. Copy data in table
    By Tommo in forum Access
    Replies: 3
    Last Post: 09-27-2015, 07:23 AM
  4. How to copy data within the same table?
    By price12 in forum Access
    Replies: 1
    Last Post: 04-23-2014, 08:34 PM
  5. copy data from one table to another
    By Sureshbabu in forum Access
    Replies: 1
    Last Post: 01-08-2012, 01:27 PM

Tags for this Thread

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