Results 1 to 3 of 3
  1. #1
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145

    I have a Save/Continue Problem!!

    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

    Click image for larger version. 

Name:	323232323232.JPG 
Views:	10 
Size:	48.0 KB 
ID:	18850Click image for larger version. 

Name:	3333333.JPG 
Views:	9 
Size:	190.1 KB 
ID:	18851

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    just add the 'empty set' to the end of each field and it wont be null (to get errror)

    txtBox = txtBox2 & ""

  3. #3
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145
    Thanks That Actually Made me Feel like a Dummy loewl

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 06-22-2014, 12:10 AM
  2. Save/Continue Is what I want???
    By Z1nkstar in forum Access
    Replies: 15
    Last Post: 06-20-2014, 12:52 PM
  3. Replies: 9
    Last Post: 03-14-2014, 01:28 PM
  4. save new record problem
    By msasan1367 in forum Access
    Replies: 11
    Last Post: 06-30-2013, 08:57 AM
  5. Replies: 5
    Last Post: 07-13-2010, 11:48 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums