473,624 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

select only the currect records in a table and use it to update another table

19 New Member
I am creating a billing system for a school with Ms Access. When I prepare the first Academic year and term bill the code below works well. After this, If I intend to prepare the second term and any other next academic and termly bill the code duplicates all the previous data, before adding the new(expected)da ta. This previous data need not to be added. This is not a duplicate but similar record.

In other words, I have a table "tblfeesdetails " which contains the bills for all classes or leveles by term and Academic year and applied or updated from a command button. Now this bill must be updated into "tblfeestra ns" by names of pupils in the respective above classes or levels. It works well for the 1 term but duplicate the previous or existing records in the "tblfeesdetails " into "tblfeestra ns" before updating the new ones. The previous records once updated no longer needed to be updated for any other time. Rather the current records base on term and academic year in "tblfeesdetails " is what is needed to used by the code below. Find hi-lighted in the attached is a snapshot of the tables silimar (duplicated) records for your perusal. please help me.



strsqldetails = "Select * from tblfeesdetails where groupid = """ & mgroupid & """; "
Set rstd = CurrentDb.OpenR ecordset(strsql details)
With rstd


Do Until .EOF
mtrans_code = !TRANS_CODE
mdebit = !DEBIT
mcredit = 0
With rstfeestrans
.AddNew
!idno = macctno
!CLASSID = mclassid
!academic_year = macademic
!term = mterm
!TRANS_CODE = mtrans_code
!DEBIT = Nz(mdebit)
!CREDIT = 0
!TDATE = mdate
.Update
End With
If Not .EOF Then
.MoveNext
End If
Loop

End With
Mar 14 '11 #1
0 986

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3526
by: Dave | last post by:
I am building an invoicing database. I have no problems searching for due dates and generating the invoice header. The problem is generating the invoice detail. My customers may have more than one item that needs to go into the invoice detail table. For example: customer #123 has 2 items that need to be placed into the detail table.
2
2626
by: Robin Tucker | last post by:
I can't get my head around this: I want to select all IDs from table A that do not have a related record in table B according to some condition: Table A contains, say, Parents and table B contains Children. I want to select all Parents that have no children called "Sally" (this is a noddy example, reminds me of being at Uni again :) ). Any ideas?
2
4858
by: fhadlaq | last post by:
I need a little help here.. I want to transfer ONLY new records AND update any modified records from Oracle into SQL Server using DTS. How should I go about it? a) how do I use global variable to get max date. Where and what DTS task should I use to complete the job? Data Driven Query? Transform data task? How ? can u give me samples. Perhaps you can email me the Demo Package as well.
2
8522
by: Mike Leahy | last post by:
Hello all, This question is related to updating tables - is there any way to calculate or update the values in a column in a table to the values in a field produced by a query result? An example of what I'm trying to do is below: update (tbl_ind_mananas LEFT JOIN (select count(*) as count, (dubicacion || zona || manzana) as cod_manzana from tbl_censo_poblacion_1993 group by dubicacion, zona, manzana) tbl1 on relacion = cod_manzana) as...
20
40090
by: Guru | last post by:
Hi I have a table which contains number of rows. I want to fetch the last 5 records from the table. I know for the first 'n' records we can use FETCH FIRST n ROWS ONLY command. But i want to fetch last 5 records. Can any one help in this...
1
1979
by: KC | last post by:
I am using Access 2002, with a database template from MS Office. The Orders Management Database. I have tweaked this for use with our company. It is a small database with close to a 1000 records in our Orders table. Within this table are 80 records that I decided to delete to clean it up a bit. When I went into my data entry form, I noticed the bottom portion of the form was blank, this is usually the area that contains each customers...
2
2293
by: Paul712 | last post by:
Recently, I have a table that I use to update a master table. When I run the same Update query that's been successful in the past, most all of the data in the fields in the update fields has been deleted from the update table and nothing is updated in the updated table. Why would this problem start occuring and is there a remedy? thanks!
22
18790
by: RayPower | last post by:
I'm having problem with using DAO recordset to append record into a table and subsequent code to update other tables in a transaction. The MDB is Access 2000 with the latest service pack of JET 4. The system is client/server, multiusers based. The MDBs are using record locking. Here is part of the code: Dim wkSpace As Workspace, db As Database Dim rstTrans As DAO.Recordset Set wkSpace = DBEngine.Workspaces(0)
6
24713
markrawlingson
by: markrawlingson | last post by:
Hopefully someone can help me out with this, it's driving me nuts... I have two tables - We'll call them table1 and table2. Table1 holds event information, and table2 holds user registration data pertaining to each event in table1. So for each record in Table1 there could be hundreds of records pertaining to that record in Table2 - I am trying to count those records (to reveal the number of people registered for the event held in table1) I...
1
1487
by: JERRYLEGUER | last post by:
I want to create a view that has distinc records of one of the five columns of the view i want to create. The view only takes data from one table.
0
8233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8170
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8675
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8619
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8474
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7158
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6108
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.