473,434 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

Same Data for the previous record

36
Hello!

I need to know how I can maintain the same data of the previous record to the new record.

For example:

In record 1. My input is a date for 7/1/07 but I need this same date in record 2.

How I can do this!

Thanks for any answer.
Aug 23 '07 #1
5 2040
missinglinq
3,532 Expert 2GB
By setting the deafult for a control to the last value entered for it. The exact syntax varies with the datatype.

For Text fields
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourTextControlName_AfterUpdate()
  2. If Not IsNull(Me.YourTextControlName.Value) Then
  3.   YourTextControlName.DefaultValue = """" & Me.YourTextControlName.Value & """"
  4. End If
  5. End Sub
  6.  

For Numeric fields
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourNumericControlName_AfterUpdate()
  2. If Not IsNull(Me.YourNumericControlName.Value) Then
  3.   YourNumericControlName.DefaultValue = Me.YourNumericControlName.Value
  4. End If
  5. End Sub
For Date fields
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourDateControlName_AfterUpdate()
  2. If Not IsNull(Me.YourDateControlName.Value) Then
  3.   YourDateControlName.DefaultValue ="#" &  Me.YourDateControlName & "#"
  4. End If
  5. End Sub
  6.  
Linq ;0)>
Aug 23 '07 #2
ElTipo
36
By setting the deafult for a control to the last value entered for it. The exact syntax varies with the datatype.

For Text fields
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourTextControlName_AfterUpdate()
  2. If Not IsNull(Me.YourTextControlName.Value) Then
  3.   YourTextControlName.DefaultValue = """" & Me.YourTextControlName.Value & """"
  4. End If
  5. End Sub
  6.  

For Numeric fields
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourNumericControlName_AfterUpdate()
  2. If Not IsNull(Me.YourNumericControlName.Value) Then
  3.   YourNumericControlName.DefaultValue = Me.YourNumericControlName.Value
  4. End If
  5. End Sub
For Date fields
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourDateControlName_AfterUpdate()
  2. If Not IsNull(Me.YourDateControlName.Value) Then
  3.   YourDateControlName.DefaultValue ="#" &  Me.YourDateControlName & "#"
  4. End If
  5. End Sub
  6.  
Linq ;0)>
Thanks for your time Ling

Ok I write the 3rd code because is a date filed but the form it's for data entry and this property is in Yes. The tap key in the keyboard clear the record for proceed to the new entry.

It's affect this code this property in YES for the form?
Aug 23 '07 #3
Scott Price
1,384 Expert 1GB
Thanks for your time Ling

Ok I write the 3rd code because is a date filed but the form it's for data entry and this property is in Yes. The tap key in the keyboard clear the record for proceed to the new entry.

It's affect this code this property in YES for the form?
Buenos Noches, El Tipo!

This code will go in the afterupdate event of your form's control that accepts the date value. The tab key that you use to go from one record to another will then NOT clear the data for the next record.

For example, if you have a form in continuous form view, you will enter the date in a text box named something like txtDate. Put this code in the afterupdate event of the txtDate control, changing the names to reflect the name of your control (Me.txtDate)

If you need an explanation in spanish let me know!

Regards,
Scott
Aug 24 '07 #4
ElTipo
36
Buenos Noches, El Tipo!

This code will go in the afterupdate event of your form's control that accepts the date value. The tab key that you use to go from one record to another will then NOT clear the data for the next record.

For example, if you have a form in continuous form view, you will enter the date in a text box named something like txtDate. Put this code in the afterupdate event of the txtDate control, changing the names to reflect the name of your control (Me.txtDate)

If you need an explanation in spanish let me know!

Regards,
Scott
Gracias Scott, Thanks for your time again.

Perdona el inconveniente lo que sucedio fue que coloque el codigo en el control y no en la forma. Es por esto que no funciono correctamente.

Agradezco a Ling por su ayuda y también a ti por la atención.

Tremendo "Site" mucho exito Scott.
Aug 24 '07 #5
Scott Price
1,384 Expert 1GB
Gracias Scott, Thanks for your time again.

Perdona el inconveniente lo que sucedio fue que coloque el codigo en el control y no en la forma. Es por esto que no funciono correctamente.

Agradezco a Ling por su ayuda y también a ti por la atención.

Tremendo "Site" mucho exito Scott.

Bueno! Si está funcionando bién, que bueno... De nada por todo.

trans:
Excuse the inconvenience, what happened is that I put the code in the control and not in the form. That's why it wasn't working correctly.

Thank you linq for your help also, and Scott for your attention.

Tremendous Site! Wishing you all success, Scott
Good! If it's working for you, that's great! You're welcome for all.

Regards,
Scott
Aug 24 '07 #6

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

Similar topics

6
by: Bob Bedford | last post by:
I've a query quite important to execute. I've to fill an array with all result, so the query is called once wich returns all ID's Then I call the same query a second time as I shown only 10...
0
by: Jawahar Rajan | last post by:
All, I have a datagrid that I use in a ASP.net web page that loads customer data based on the selected customer ID Some Customers will have no data in the database (which is oracle 9.2) . So I...
1
by: kufre | last post by:
I need some help. How can I automatically fill my combo box in a new record with data from previous similar record. My form has a option group button with two check box. What I'm trying to do is...
4
by: Claudia Fong | last post by:
Hi, I have a form where I need to display the data of a department that stores in a access db. When I first load the form it will call a function name loaddata which will get the first...
1
by: geekwagon | last post by:
Not a SQL guy but can do enough to be dangerous :) Trying to update a record. We have records that have a field with data surrounded by some comment text such as *** Previous Public Solution...
6
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called...
7
by: FNA access | last post by:
I have a mainform that has a subform in the detail section and a subform in the footer section.(Both subforms are in datasheet view) When I click the navigation button to create a new record on the...
0
by: Gina G | last post by:
I have to log Regular services that occur as required but not more than 31 days later than the previous. Additionally a major service must occur within 6 months of the previous major service. A...
1
by: bkberg05 | last post by:
Hi -I have a form which contains a sub-form. The sub-form is tied to the main form by a shared field called Project_ID. The main form has one record per Project. The sub-form has many records per...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
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
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...
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: 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...

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.