UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Copy Value From Last Record In Continious Form, Access 2007    
 
   
edin14166
post Jun 13 2018, 03:54 AM
Post#1



Posts: 310
Joined: 15-November 05
From: BiH


hello,
I have a continius subform with numeric values which calculates

ODkilometraza
minus
DOkilometraza

Now I need to copy in new record from DOkilometraza from previous to new record to control ODkilometraza.

What should I do?

Thanks in advance...
Go to the top of the page
 
DanielPineault
post Jun 13 2018, 05:23 AM
Post#2


UtterAccess VIP
Posts: 5,973
Joined: 30-June 11



There are different solutions, but if you need only duplicate one field, then try something like

CODE
Private Sub cmd_CopyLastRec_Click()
    Dim vODkilometraza        As Variant
    On Error GoTo Error_Handler

    With Me.Recordset
        .MoveLast
        vODkilometraza = Me.ODkilometraza
        .AddNew
        If IsNull(vODkilometraza) = False Then Me.ODkilometraza = vODkilometraza
    End With

Error_Handler_Exit:
    On Error Resume Next
    Exit Sub

Error_Handler:
    MsgBox "The following error has occured" & vbCrLf & vbCrLf & _
           "Error Number: " & Err.Number & vbCrLf & _
           "Error Source: cmd_CopyLastRec_Click" & vbCrLf & _
           "Error Description: " & Err.Description & _
           Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _
           , vbOKOnly + vbCritical, "An Error has Occured!"
    Resume Error_Handler_Exit
End Sub




--------------------
Daniel Pineault (2010-2017 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
edin14166
post Jun 13 2018, 05:31 AM
Post#3



Posts: 310
Joined: 15-November 05
From: BiH


Thanks Daniel,
it works...
This post has been edited by edin14166: Jun 13 2018, 06:20 AM
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    14th August 2018 - 10:21 AM