C
Cesarini
I have a Data Entry form in which the user have to insert a specific numbrer
of record, depending on the type of product he choose. Ej: The product "A"
have to have 3 data, so it will need to insert 3 record on the table only, no
more.
I have created a simple code in VB that I supose to have to restrcit the
number of record records, depending on a Textbox value
****************************************
CODE
****************************************
Private Sub LECTURA_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_Lectura
Dim Respuesta
If Form.CurrentRecord <= Forms!lecturas!TXTMuestras Then
If Val(LECTURA) = 0 Then
MsgBox "Value can not be a zero", vbOKCancel + vbCritical, "Zero
value!"
Cancel = True
Else
ID_SKU = "00329"
ID_LECTURA = 1
NO_LINEA = Form.CurrentRecord
End If
Else
Respuesta = MsgBox("You has reached the maximun number of samples
for this product" & vbCrLf & _
"Verify samples please.", vbCritical + vbOKOnly,
"Reading samples")
Cancel = True
End If
Exit_Lectura:
Exit Sub
Err_Lectura:
MsgBox Err.Description
Resume Exit_Lectura
End Sub
*************************************
End code
*************************************
The problem I am having is the crusor. It moves to the next record after the
maximum value for a specific product have been reached.
Thanks in advance,
of record, depending on the type of product he choose. Ej: The product "A"
have to have 3 data, so it will need to insert 3 record on the table only, no
more.
I have created a simple code in VB that I supose to have to restrcit the
number of record records, depending on a Textbox value
****************************************
CODE
****************************************
Private Sub LECTURA_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_Lectura
Dim Respuesta
If Form.CurrentRecord <= Forms!lecturas!TXTMuestras Then
If Val(LECTURA) = 0 Then
MsgBox "Value can not be a zero", vbOKCancel + vbCritical, "Zero
value!"
Cancel = True
Else
ID_SKU = "00329"
ID_LECTURA = 1
NO_LINEA = Form.CurrentRecord
End If
Else
Respuesta = MsgBox("You has reached the maximun number of samples
for this product" & vbCrLf & _
"Verify samples please.", vbCritical + vbOKOnly,
"Reading samples")
Cancel = True
End If
Exit_Lectura:
Exit Sub
Err_Lectura:
MsgBox Err.Description
Resume Exit_Lectura
End Sub
*************************************
End code
*************************************
The problem I am having is the crusor. It moves to the next record after the
maximum value for a specific product have been reached.
Thanks in advance,