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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy Last Record Button

Status
Not open for further replies.

colval

MIS
Feb 24, 2011
49
GB
Does anyone know if it is possible to create a button attached to an event procedure that will Copy the last record that was displayed on form.

We use a form for data entry and sometimes the records are the same. We would like to able to copy the last record and then make the odd change.

I have tried various things but no luck so far

Any ideas please. Thanks
 
Yes that only works on individual fields doesnt it, for example you are in Filed 1 and you press ctrl ' and that brings in the last record for that field.

I want to be able to copy in all entries for the last record in one go?

Unless I am misunderstanding you.

Thanks
 
How are ya colval . . .

See my post here thread702-1382356 ... [blue]no button required![/blue]

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
HI TheAceMan1

I have just tried to test this in a simple table and form.

Table1 (ID (autonumber), Name, Department)
Formtable1

The form comes up with the first record on open, if I click new on the Record buttons it goes to the autonumber and when I go into Name nothing appears.

In all the fields in the form property in the TAG I have out a ?
In the forms properties for Ondblclick I have created the code for an Event Procedure

Private Sub Form_DblClick(Cancel As Integer)
Dim ctl As Control, DQ As String

DQ = """"

If Not Me.NewRecord Then
For Each ctl In Me.Controls
If ctl.Tag = "?" Then
ctl.DefaultValue = DQ & ctl & DQ
End If
Next
End If
End Sub

Not sure why it is dblclick as basically what I want to happen is when I click the new arrow I want it to bring in the last record information , except of course the auto number should be the next number available to prevent duplicate keys.

In theory I think for the situation I would like is to use the new
but then have a button I can press to bring in the last record, because it may be I dont always want the last record there.

Thanks


 
colval . . .
colval said:
[blue]Not sure why it is dblclick . . .[/blue]
There are situations where you may need to single-click a record. Hence the reason for double-click, whick also shows greater intent. Being able to select any record provides more versatility. Maybe the record you wanted was'nt the last?

Are you sure your double-clicking? ... and if you want the last line just double-click the selector of the last line.

[blue]Your Thoughts? ...[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Yes I am sure I am

I have the form and table and the records are

ID Name Department
1 Colin IT
2 Val Chippy

I then select select new on the Records selector and the ID (autonumber) is highlighted first on the new record, I double click this nothing happens, I move to the Name field and double click and nothing happens and then I tried the same with Department.

What I would expect to happen (and if I am understanding you correctly), when I am new record and double click on Name after being in ID 2 last, it should bring in Val.

Please advise more if possible

Ideally though I would prefer a button that brings in all fields from the last record viewed all at once, rather than dblclicking on all the fields.

Thanks for your help its appreciated

 
colval . . .

When you set the question mark (?) in the [blue]Tag[/blue] property be sure its a question mark only! ... [red]no quotations!, nothing else![/red]

Also, be sure to [blue]double-click the record you want to transfer first[/blue] ... then select [blue]new record[/blue].

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
HI

Checked all the Tag's and they are all purely ? only.

Went to last record, double clicked then addded new and nothing appears in the new record.

Any ideas??

Thanks as always
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top