Increment a value

Giganews Newsgroups
Subject: Increment a value
Posted by:  noodnutt (noodnu…@gmail.com)
Date: Thu, 19 Dec 2019

Hi All

I have seen many examples of this but many don't seem to fit what I require:

MainForm: frmShift

anfShiftNo

SubForm: frmRun

lnfShiftNo
snfRunNo
dtfDepart
dtfReturn

The ShiftNo is Parent/Child linked.

snfRunNo.Default = 0

I update snfRunNo.value = 1 in the Before_Update() of dtfRunDepart

If IsNull(Me.mnfRunNo) Or Me.mnfRunNo = 0 Then
Me.mnfRunNo = 1
End If

There are occasions when a driver has to do multiple runs which means I have to increase snfRunNo +1 each time, and in-as-much as I know the following Syntax is way wrong, It's the best way for me to explain.

In the After_Update() of dtfReturn:

Ask = MsgBox("Do you want to enter another Run for this Shift", vbYesNo)
If Ask = vbNo Then Exit Sub
If Not IsNull(Me.mnfRunNo) Then
If Me.mnfRunNo > 0 Then
Me.mnfRunNo = DLast("[mnfRunNo]", "tblDataRun") + 1
End If
End If

As always
TIA
Mark.

Replies