VBA code to update Ms access one table from another table or using update design query in ms access

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ม.ค. 2025

ความคิดเห็น • 10

  • @abcd2-k4s
    @abcd2-k4s 3 ปีที่แล้ว +1

    Your chanel is very important to me

  • @tutsecret499
    @tutsecret499 3 ปีที่แล้ว +1

    I have DOB and Age in the table. In the query: Age column and Calculated Age column. How do I grab AUTOMATICALLY behind the scenes all the results from the Calculated Age column from the query and place on the Age column that is located in the table and also in the query. The only way I found so far was highlight and copy the Calculated Age column from the query and highlight the Age column either inside the query or in the table and paste all the results at once, and works. But I want to avoid this manual routine. Is there a macro or VBA to do this copy and paste these results to be stored in the table or another way. We want these results to be stored in the Age table. Would be so nice if the user when enters the DOB on the table, the Age field gets populated with the age. So I had to use the query to calculate the age of a necessity. Users were using manual hardcopy Age chart to input the Age in the Age field. So I created this automated feature to spare my hands and eyes strain, even with the copy and paste method, it's a breeze, in a blink of eyes, it input hundreds, thousands ages saving typing, time gain, less errors, and no hands and neck injury. I also tried to use query update, it says you can't update table with calculated field. That sucks.

    • @vbaautomationtutorialpoint5315
      @vbaautomationtutorialpoint5315  3 ปีที่แล้ว

      Yes it's can be possible through VBA code

    • @tutsecret499
      @tutsecret499 3 ปีที่แล้ว

      How I do that? and it's in Access.

    • @vbaautomationtutorialpoint5315
      @vbaautomationtutorialpoint5315  3 ปีที่แล้ว

      We have fire two SQL command one for insert and for update for calculated column through VBA by one click

    • @tutsecret499
      @tutsecret499 3 ปีที่แล้ว

      @@vbaautomationtutorialpoint5315 which code do you use. In the table I have Age, column, number format, and birthdate column, date/time format. In my query I have CALCULATED AGE column where I have all the age calculated, also in the query I have the Age column. So I highlight the CALCULATED AGE column, copy and then I highlight the Age column and paste, and the results are stored on the Age column. So do I copy and paste this routine via VBA or/and macro behind scene. I have another database where the Age field is number format. The both databases has the client DOB and Age field, but one they format the Age as text, and the another database they formatted the Age as number format. I did not created these databases, I created the CALCULATED AGE feature, because people were entering manually the age by using a hard copy to get the age to input on the Age field, how stupid is that. I always refused to use the hardcopy age chart, it's stupid and causes a lot eye strain, unnecessary typing, errors, and delay. Can you imagine entering Age one by one for dozen, hundreds, thousands records leading to wrist, hands injuries. We have a lot databases and most of them has the client DOB and Age.

    • @vbaautomationtutorialpoint5315
      @vbaautomationtutorialpoint5315  3 ปีที่แล้ว

      @@tutsecret499 I will create a userform to enter the value in ms access database and will fire two query using one event that is click