N
ndunwoodie
Mine occurs when the code below is excuted. The button searches for records
marked with an "X" in one of the fields. When an "X" is encountered, a date
field is incremented and the "X" is erased. Any thoughts?
Private Sub cmdSubmit_Click()
On Error GoTo Err_cmdSubmit_Click
Dim rst As New ADODB.Recordset, strSQL As String, i As Integer, SLDate As
Date, strName As String, varAbs As Variant
rst.Open "tblSilTrans", CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
With rst
Do Until (.EOF)
strName = ![txtName]
SLDate = ![datStartDate]
varAbs = Nz(![txtAbs])
If varAbs = UCase("x") Then
SLDate = DateAdd("d", 1, SLDate)
SLDate = SLD(SLDate) ' function to make sure SLDate is not a
weekend or holiday
![datStartDate] = SLDate
![txtAbs] = " "
End If
.MoveNext
Loop
End With
rst.Close
Set rst = Nothing
Exit_cmdSubmit_Click:
Exit Sub
Err_cmdSubmit_Click:
MsgBox Err.Description
Resume Exit_cmdSubmit_Click
End Sub
marked with an "X" in one of the fields. When an "X" is encountered, a date
field is incremented and the "X" is erased. Any thoughts?
Private Sub cmdSubmit_Click()
On Error GoTo Err_cmdSubmit_Click
Dim rst As New ADODB.Recordset, strSQL As String, i As Integer, SLDate As
Date, strName As String, varAbs As Variant
rst.Open "tblSilTrans", CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
With rst
Do Until (.EOF)
strName = ![txtName]
SLDate = ![datStartDate]
varAbs = Nz(![txtAbs])
If varAbs = UCase("x") Then
SLDate = DateAdd("d", 1, SLDate)
SLDate = SLD(SLDate) ' function to make sure SLDate is not a
weekend or holiday
![datStartDate] = SLDate
![txtAbs] = " "
End If
.MoveNext
Loop
End With
rst.Close
Set rst = Nothing
Exit_cmdSubmit_Click:
Exit Sub
Err_cmdSubmit_Click:
MsgBox Err.Description
Resume Exit_cmdSubmit_Click
End Sub