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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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,214,415
Messages
6,119,381
Members
448,888
Latest member
Arle8907

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