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: 314
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: 6,128
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



Go to the top of the page
 
edin14166
post Jun 13 2018, 05:31 AM
Post#3



Posts: 314
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    20th October 2018 - 06:04 AM