Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / December 2007

Tip: Looking for answers? Try searching our database.

Repeat data from previous records in a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sjf - 30 Nov 2007 17:10 GMT
I am creating a a form for data entry and want to know if there is a way to
repeat data in fields from the previous record (or default to previous
record).  For example, I user has 100 entries - I would like to set up the
form so they do not have to enter their ID each time they enter a record.
Paul Sanguinetti - 30 Nov 2007 17:29 GMT
When you hold the ctrl key and click the apostrophe key ' access copies the
contents of the same field from the previous record. This assumes that the
new record immediately follows the old record so you may have to sort the
source table and requery it after each time a new record is inserted. If you
are entering all 100 records one right after the other and the key is
sequential you shouldn't have to sort it.

> I am creating a a form for data entry and want to know if there is a way to
> repeat data in fields from the previous record (or default to previous
> record).  For example, I user has 100 entries - I would like to set up the
> form so they do not have to enter their ID each time they enter a record.
Joy - 30 Nov 2007 22:02 GMT
Is there a way to do this so it will be automatic?
Signature

Thanks, Joy

> When you hold the ctrl key and click the apostrophe key ' access copies the
> contents of the same field from the previous record. This assumes that the
[quoted text clipped - 7 lines]
> > record).  For example, I user has 100 entries - I would like to set up the
> > form so they do not have to enter their ID each time they enter a record.
Linq Adams - 30 Nov 2007 22:32 GMT
Sure, you just set the DefaultValue for the field in the field's AfterUpdate
event!
After a value is entered, in your date field, for instance, it will
automatically be entered in each new record thereafter until you change it
(in which case the new entry will become the default value) or you close down
the form

The syntax is slightly different, depending on the datatype.

For Date fields

Private Sub YourDateControlName_AfterUpdate()
If Not IsNull(Me.YourDateControlName.Value) Then
 YourDateControlName.DefaultValue ="#" &  Me.YourDateControlName & "#"
End If
End Sub

For Text fields

Private Sub YourTextControlName_AfterUpdate()
If Not IsNull(Me.YourTextControlName.Value) Then
 YourTextControlName.DefaultValue = """" & Me.YourTextControlName.Value &
""""
End If
End Sub

For Numeric fields

Private Sub YourNumericControlName_AfterUpdate()
If Not IsNull(Me.YourNumericControlName.Value) Then
 YourNumericControlName.DefaultValue = Me.YourNumericControlName.Value
End If
End Sub

Signature

There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

sjf - 03 Dec 2007 17:51 GMT
That is what I am looking for.  I've was able to get the "CTR + Apostrophe
(") to work but it only works for 1 record at a time and you have to keep
doing it for each new record.

> Is there a way to do this so it will be automatic?
>
[quoted text clipped - 9 lines]
> > > record).  For example, I user has 100 entries - I would like to set up the
> > > form so they do not have to enter their ID each time they enter a record.
Linq Adams - 03 Dec 2007 21:11 GMT
Glad it helped!

Signature

There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.