Last record default

AndyMcC

New Member
Joined
Nov 27, 2003
Messages
21
How can I display "last record" information on a form in add mode.

I have a set of 50 variables to input to an Excel calculation via an Access form, the variables then being stored in an Access database. Although all these variables have the potential to change, in reality only a handful of them actually change from calculation to calculation.

What I need to be able to do is display the last record values as a default setting on the form, whilst the act of opening the form will create a new record.

Any ideas? :rolleyes:
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Here is some code, it is old and not well formed but it works :)

Code:
Sub Up_Date()
Dim This_Form_Name As String
Static pc As String
Static bat As String
Static pn As String
Static v As String

On Error GoTo update_error_trap
This_Form_Name = Screen.ActiveForm.Name
DoCmd.GoToRecord acForm, This_Form_Name, acLast
 pc = Screen.ActiveForm![Product Code]
 pn = Screen.ActiveForm![Product Number]
 bat = Screen.ActiveForm![Batch Number]
 DoCmd.GoToRecord acForm, This_Form_Name, acNewRec
 Screen.ActiveForm![Product Code] = pc
 Screen.ActiveForm![Product Number] = pn
 Screen.ActiveForm![Batch Number] = bat
 Screen.ActiveForm![Product Code].SetFocus
 Screen.ActiveForm![Product Number].SetFocus
 Screen.ActiveForm![Roll Number].SetFocus
update_error_trap:
End Sub

this code works from a hotkey but it should give you some ideas.

HTh

Peter
 
Upvote 0

Forum statistics

Threads
1,216,172
Messages
6,129,291
Members
449,498
Latest member
Lee_ray

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top