A
Andi Mayer
is the input everytime a Number? (NewData)
is the field Transaction numeric?
I changed also the Docmd.openform
Private Sub Combo0_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_Handler
Dim rst As DAO.Recordset
Dim lngTransaction As Long
If MsgBox(NewData & " ... not in list, add it?", _
vbOKCancel, "New Transaction") = vbOK Then
Set rst = CurrentDb.OpenRecordset("MyCheckRegister")
With rst
.AddNew
.Fields("Transaction") = NewData
If IsNull(Me.txtTransactionDate) Then
.Fields("TransactionDate") = Now()
' .Fields("TransactionDate") =#1/1/1900#
Else
.Fields("TransactionDate") = _
Format(Me.txtTransactionDate, "\#mm\/dd\/yyyy\ hh\:nn\:ss\#")
End If
.Update
' .Bookmark = .LastModified
' lngTransaction = .Fields("Transaction")
.Close
End With
Response = acDataErrAdded
DoCmd.OpenForm "frmCkEntry", , , "Transaction =" _
& NewData, , acDialog
Else
Response = acDataErrContinue
End If
Exit_Here:
Set rst = Nothing
Exit Sub
Err_Handler:
Response = acDataErrContinue
MsgBox "Error: " & Err.Description
Resume Exit_Here
End Sub
BTW: its nearly 1' o'clock in the night at my timezone, therefore I am
going to sleep now
read you tomorrow
is the field Transaction numeric?
I changed also the Docmd.openform
Private Sub Combo0_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_Handler
Dim rst As DAO.Recordset
Dim lngTransaction As Long
If MsgBox(NewData & " ... not in list, add it?", _
vbOKCancel, "New Transaction") = vbOK Then
Set rst = CurrentDb.OpenRecordset("MyCheckRegister")
With rst
.AddNew
.Fields("Transaction") = NewData
If IsNull(Me.txtTransactionDate) Then
.Fields("TransactionDate") = Now()
' .Fields("TransactionDate") =#1/1/1900#
Else
.Fields("TransactionDate") = _
Format(Me.txtTransactionDate, "\#mm\/dd\/yyyy\ hh\:nn\:ss\#")
End If
.Update
' .Bookmark = .LastModified
' lngTransaction = .Fields("Transaction")
.Close
End With
Response = acDataErrAdded
DoCmd.OpenForm "frmCkEntry", , , "Transaction =" _
& NewData, , acDialog
Else
Response = acDataErrContinue
End If
Exit_Here:
Set rst = Nothing
Exit Sub
Err_Handler:
Response = acDataErrContinue
MsgBox "Error: " & Err.Description
Resume Exit_Here
End Sub
BTW: its nearly 1' o'clock in the night at my timezone, therefore I am
going to sleep now
read you tomorrow