473,461 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

auto fill previous value from onther fileld

1
I Have Few product name with code every day i want add new new value but i need auto fill previous value
like Column A1, A2, A3 and A4
A4 = A1-A2+A3
when i add new date than i need Previous Value from A4 in A1
Dec 14 '19 #1
2 1455
SioSio
272 256MB
Expand|Select|Wrap|Line Numbers
  1. 'Process when the cell value changes
  2. Private Sub Worksheet_Change(ByVal Target As Range)
  3.  If InStr(Target.Address, ":") <> 0 Then Exit Sub
  4. 'Execute processing if "A" is included in the address of the argument Target
  5. 'StrConv and Lcase are case insensitive
  6.  If InStr(Target.Address, "A") <> 0 Then
  7.      MsgBox "Entered in column A", vbInformation
  8.   End If
  9. End Sub
Dec 16 '19 #2
This is a very basic design code for what your asking for... you would just use "MovePrevious" to get to the previous record and get your previous value in the recordset. Hope this gets you close enough to work the rest out on your own.

Expand|Select|Wrap|Line Numbers
  1.     Dim rst As Recordset
  2.     Dim strSQL As String
  3.  
  4.     strSQL = "Select * From [Tbl] Where (criteria)"
  5.     Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
  6.     rst.MoveFirst
  7.  
  8.     Do While (criteria)
  9.         A1 = rst!SQL_Field
  10.  
  11.         rst.MoveNext
  12.     Loop
  13.  
  14.     rst.Close
  15.     Set rst = Nothing
  16.  
Dec 18 '19 #3

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

Similar topics

1
by: Maurice Mertens | last post by:
Does anyone know how to get an auto-filling combobox on a form? When I add a combobox to a form I can set the DropDownStyle property to DropDownList. This will make the combobox auto-filling. But...
3
by: Maurice Mertens | last post by:
Hi all, In VB.NET you can set the DropDownStyle for a combobox to 'DropDown' or 'DropDownList'. When you set it to DropDownList, it supports auto-fill. But when you set it to 'DropDown', the...
3
by: MatGyver | last post by:
I am going nuts trying to figure this out, any help will be appreciated. I have an existing table called "Parts". And in this table I have the following columns: "ID" "Part Number" "Part...
2
by: Edwin Knoppert | last post by:
I would like to instruct a grid which autofill's the columns to exclude time or date from a date field when date or time is 0. Date and time can be stored in a date field, my grid shows for...
2
by: Elainie | last post by:
I have been trying to auto fill fields with DLookup - but it doesn't seem to work..... can you help... I have a name field and I want the address to automatically fill in when the name field...
0
by: KelHemp | last post by:
Greetings, I've been using this site for lots of access help in the past, and it's very helpful! I have a new complexity for you all. Reworking a form to record 70-80 years of oil production on...
9
by: DAHMB | last post by:
I have a Report in which I have one of the fields set up to launch a form with the On Click event. I would like to have the form launch and auto fill a field with the value of the field clicked in...
10
by: Charles Richmond | last post by:
Is there some parameter I can set via Javascript that will cause the browser to *not* auto-fill forms, regardless of the browser settings??? --...
6
by: wisni1rr | last post by:
I have a form "Add" that I use to enter data into my database. All the controls on this form are textbox controls (for data entry). How would I make these textboxes auto-fill as the user types into...
2
by: peterbites | last post by:
Hi, Programmers I'm Creating a database app for where I work to track plant wear and hopefully use the data to predict plant breakdowns before they happen. I have a form that contains a sub form &...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...
1
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...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.