If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Trying to add new Transaction code
Hi all - Access 2000 XP, W2K
I have a data entry form with a control to enter transactions to the table, set to LimitToList. I want to be able to add a new transaction at the time the entry is being made, so that the user does not have to go to the table to enter the new Transaction. I have the code in the NotInList event and the add dialog box comes up fine, but, when I enter the new Transaction and try to go to the next entry control, I get an error message that say: "Error: The field 'MyCheckRegister.TransactionDate' cannot have a Null value because the Required property for this field is set to True. Enter a value in this field." There is a date entered in that control on the form. Here is the code that I now have for the Transaction control to add the new Transaction: /Start Code/ ***************************** Private Sub cmbTransaction_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 .Update .Bookmark = .LastModified lngTransaction = .Fields("Transaction") .Close End With Response = acDataErrAdded DoCmd.OpenForm FormName:="frmCkEntry", _ wherecondition:="Transaction =" & lngTransaction, _ WindowMode:=acDialog Else Response = acDataErrContinue End If Exit_He Set rst = Nothing Exit Sub Err_Handler: Response = acDataErrContinue MsgBox "Error: " & Err.Description Resume Exit_Here End Sub *************************** /End Code/ The date control works fine with no error message when I enter the date and tab to the Transaction control. It is only after the new Transaction has been added and tabbing to the next entry that the error message gets fired. I have been over and over the code and form controls and such, but, I can't find where the problem is. I would truly appreciate it if someone could point me in the right direction here to correct this problem. Jan Smiles are meant to be shared, that's why they're so contagious. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Barcodes | TarponZeke | General Discussion | 4 | October 25th, 2004 08:04 PM |
Form to generate a Report code | Pat Coleman | Setting Up & Running Reports | 4 | July 16th, 2004 12:58 PM |
Hide or show Control Button on Form in Access 97 | Pete Sperling | Using Forms | 8 | July 13th, 2004 04:13 PM |
Is it possible to include Begin And End Transaction code in VBA ? | Jean | New Users | 10 | June 29th, 2004 11:31 PM |