Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy data from previous record. 2

Status
Not open for further replies.

prodtest

Technical User
Aug 29, 2003
55
0
0
GB
I need help copying data from a previous record, I basically have a form for entering in stock movements and a lot of the time data entry is very repetative. For instance I may have to enter in 20 items with the same order number so only the part number and quantity change on the form from the last entry. Is it possible for the form to display the previous record, but if the data is changed it creates a new record.
Cheers
 
Select all of your fields and then set the AfterUpdate property of each of the fields to a function. Like this: =SetDefault()

Function SetDefault()

Dim ctl as control

set ctl = Screen.ActiveControl

ctl.DefaultValue = ctl.value

End Function
 
This is the same type of action im trying to create,
But with a added request.

I have a form with a sub form.

On the form in a combo box I select a customer.

I would then like to be able to populate the sub form with the same data from when this customer ordered last week.
If a change is required by editing the quantity field,
then save it as a new record.

Any help would be much appreciated

thanks hp-webber


 
Cheers Fancy Prairie, worked exactly how I needed it to.
Prodtest
 
Just realised something, When I enter in non numerical characters it won't copy it when the screen form refreshes.
Any ideas?
 
Has anyone found out how to make FancyPrairie's suggestion work on non-numeric data?

Thanks in advance,
Chalmers
 
Try this:
Code:
Function SetDefault()

    Dim ctl as control

    set ctl = Screen.ActiveControl

    ctl.DefaultValue = """" & ctl.value & """"

End Function
 
Thanks, FancyPrairie, that works.[2thumbsup]
I did find one thing, though. If the next record has identical values (no field changes: 2 male fish weighing 3 lbs on Pond1, Sample1) a new record will not be created. At least one field must be changed, to create the new record. I explained this to the user, and that all he need do is to retype in the weight of the fiesh. He is happy with this.

Oh, the very first field (the key) is an autonumber; would that be the reason for the above?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top