473,883 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to update a field in a table with a value in the same record based on a form?

76 New Member
Is this even possible?

I'm working on a project and its based on months!
Everytime I click a a button cmdRunMonthEnd I would like it to do the following. I will just explain from the part where I don't get it right!

I have a table TrnControl with the following fields:
TrnYear, TrnMonth, CurrentBalance, 1,2 through to 12 (months).

I also have this form called RunMonthEnd. With the following unbound textboxes:
Txt.Year, txtMonth, txtNewMonth, txtCurrentBalan ce and a command button cmdRunMonthEnd.

As I said, everything works as I want up to the point where click the button. When I click the button I want the following to happen if it's even possible.

When it is clicked I want it to update the table called TrnControl.
it should take the value from the forms text box called txtCurrentBalan ce and update one of the month's (1-12). It should update to the field which is in the txtNewMonth.

So if the txtNewMonth is 3, then it must take txtCurrentValue and update the field called 3 in that same record where TrnYear is the same as txtYear on the form.

please help, it seems impossible to me! Is it?

Feb 24 '12
11 2076
759 Contributor
:) If you think so... good luck !
Feb 25 '12 #11
32,584 Recognized Expert Moderator MVP

No-one's asking you to be coder of the year here. What you post would only be a start. However, if you cannot think of any code after we've spent time trying to explain these basic concepts to you then it seems we're wasting our time. I've already laid out the basic logic of the code for you in post #. This is a site for offering help to coders, not to code for other people for free. If you need it done for you then you need to think about paying someone for their expertise. Here, we offer help to fellow professionals and amateurs. If you're not prepared even to have a crack at it, after the basics have already been provided for you, then I don't see how you can consider yourself one of those.

As for the month fields, you might consider field names of M1, M2, ... M12 and control names on your form of txtM1, txtM2, ... txtM12. This avoids the silly situation where anything is named simply as an integer value.
Feb 26 '12 #12

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

Similar topics

by: Sven Seljom | last post by:
Hi all! I want to take the value from one form-field, deduct the VAT and return the value in another form-field. I have made a Public Function for this and attached it to the text-box. Can anybody help me with the correct syntax? Here's what I got so far: Public Function specify_VAT() Dim vat
by: John Baker | last post by:
HI: I have a situation where I wish to enter a value in an unbound field on a form and then change the same field in each record on the form so that it reflects the value entered. THe form is suppored by an updatable query (linked to a table). I would rather not use a query approach because it will result in a need for a new form and will create its own complications (although this could be done) I would like to make the change so that it...
by: EKL | last post by:
Hi, I'm making a sort of Customer and Orders database in MS Access 2003. My problem is that I wish to update the table "tblTransaction" based on changes made in the table "tblOrderDetails". There is no direct relationship between these two tables. The "tblProducts" has a one-to-many relationship to " tblOrderDetails" and "tblTransaction". I use the "tblTransaction" to count number of items in stock for each product. I therefore wish...
by: RC | last post by:
I have an Access 2002 database with many tables and forms (but just to keep things simple, let's say the DB has one Table "Table1" and one Form "Form1"). I have managed to cobble together so much complex code to add records and edit records I need to step back and ask you all what is the proper way to do this. The database is DAO. The table has Columns SerialNumber, CPU, HardDrive and Model. I am trying to use a Form to fill out the...
by: Brett | last post by:
My database has 2 tables: Table1 & Table2. If a field is not null on a record in table2, then the not null fields in table1 that correspond to the records in table1 needs to be updated to match the field in table2. What I have is a form that is linked to Table2. If the users want to change a field in the main database (table1), they fill the change in to the form (which is linked to table2) If there is no change to the field, they simply...
by: sensreview | last post by:
Hello, I need help in selecting a value from combo list thru one lookup table and update different table on MS access form. For eg; I have a lookup table of usernames, I need to use this lookup table in all my other forms to update different table selecting the username from my lookup table. I tried Docmd.runsql but unable to succeed.
by: sara | last post by:
I have a Memo field in a table to hold notes from a conversation a social worker has had with a client (this is for a non-profit). If the user needs to update the memo field, I need to find the original record (which I am doing fine - getting the correct key) and I need to update the "notes" with the new value from the form, which I store in a String Variable. (I've tried storing in a Variant variable; didn't work for me)
by: prosad | last post by:
hello, Just solved a problem using Javascript onclick, can click on any cell in a dynamic table and it will pass the innerText object value to my form text field. parts of code given below: <script type="text/javascript"> function select_cell(obj) { document.getElementById('complaint').value = obj.innerText; document.getElementById('selected_form'); }
by: Ferasse | last post by:
Hi, I'm an occasional Ms-Access developer, so there is still a lot of stuff that I don't get... Right now, I'm working on a database that stores contractual information. One of the form that I created is based on a query that links several tables. When I try to insert a record in this query-based form, I can only update the fields that are used to build relations with other tables.
by: prashantdixit | last post by:
Hi, I am developing a stock control software. Iam stuck somewhere. I have a form "Add new stock" consisting of combobox, text boxes etc. which is used to add records in a table. I have another form which has "Add Similar To" button. The table which i used to store records contains a field call "Add More Quantity". If a user enters any numerical value in this field against any record and click on "Add Similar To" button then same "Add New...
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...
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...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.