Copy To next record

Number11

Member
Local time
Today, 22:14
Joined
Jan 29, 2020
Messages
623
Hi, I am looking for a way to copy current record created within a form to a new record like addresses ect?
 
Why for the love of databases and normalization would you want to copy address data?
Normalize your data into tblAdress and tblResident and there is no need to do this!
 
need users to copy customer address to next record to book a different job
 
so you have a "customer table" which holds the addres and a job (junction) table to assign jobs to adresses. No need to copy data.
 
number,

this question is asked all the time. maybe you can make use of these, if you don't use anyone else's stuff already posted. the file "copy edited record to new" was done for a previous question asker. the file "Fill New Record From Previous Record's Data" is an illustration done long ago.
 

Attachments

@ namliam
Thanks I dont have a customer table, users have to enter it within the field on the form, so i need to copy customer name address postcode fields ect
 
In which case fix your design to create a customer table and prevent a lot of headaches in the future.
 
In which case fix your design to create a customer table and prevent a lot of headaches in the future.

Thats not something that we wish to do - just looking for the user to copy customer name address ect to another form to request another order using the same address/customer details
 
Number11,
namliam has identified a database design issue -missing table and normalization - and your response is
Thats not something that we wish to do
???
 
You can use the AfterUpdate event of the Control holding your data to set the DefaultValue for the Field. From that time forward, until you either manually change the data or close your form, the data will be entered automatically in each New Record.

Code:
Private Sub YourControlName_AfterUpdate()

   Me.YourControlName.DefaultValue = """" & Me.YourControlName.Value & """"

End Sub

This syntax is valid for Text, Number, DateTime and Boolean Datatypes.

You’ll need to do this for each Control that you want to ‘carry forward.’

If you have a slew of Controls to do this for, you can use the Tag Property to mark the ones to be defaulted and then loop through them, setting the DefaultValue.

  • Go into Form Design View
  • Select all Controls you want to 'carry forward,' by pressing and holding down the <Shift> Key and clicking on each one.
  • Go to Properties - Other
  • In the Tag Property enter CarryForward (without quotes)

Now use this code:

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)

Dim ctl As Control

For Each ctl In Me.Controls

  If ctl.Tag = "CarryForward" Then

    ctl.DefaultValue = """" & ctl.Value & """"

  End If

Next ctl

End Sub

Each of the "tagged" Controls' values will be carried forward into a New Record until you either Edit the data in a given Control or Close the Form or Access itself.

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom