I have a Form that Adds New Records to the Database.
I have 3 Buttons that they can Press Save/Close, Save/Cont., or Undo/Close
When they Save/Cont. If one of the fields on my Code don't have any data in them I get an Run-time Error Code '94': Invalid use of Null.
1. Is there a way I can Put an If Statement that say If (the Notes Field) has no value then bypass it but keep all the other values?
Code:
Private Sub Command652_Click()
'Set Variables
Dim MyDateEntered As Date
Dim MyCustomer As String
Dim MySalesOrder As String
Dim MyShipTo As String
Dim MyStatus As String
Dim MyCustomerPurchaseOrder As String
Dim MyPartsNotes As String
'Copy fields to variables
MyDateEntered = Me.DateEntered
MyCustomer = Me.Customer
MySalesOrder = Me.SalesOrder
MyShipTo = Me.ShipTo
MyCustomerPurchaseOrder = Me.CustomerPurchaseOrder
MyPartsNotes = Me.PartsNotes5 'This is the Notes field that is Causing the Problem
'Go to a new Record
DoCmd.GoToRecord , , acNewRec
'Reverse the process and plug Values into New Record
Me.DateEntered = MyDateEntered
Me.Item = MyItem
Me.Customer = MyCustomer
Me.SalesOrder = MySalesOrder
Me.ShipTo = MyShipTo
Me.CustomerPurchaseOrder = MyCustomerPurchaseOrder
Me.PartsNotes5 = MyPartsNotes
End Sub
