Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    But the UPDATE will error because of missing apostrophes. Same ones that were missing from the INSERT.



    Still don't understand why setting Tag property.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  2. #17
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262
    I updated my Add/Update code:

    Code:
    Private Sub butAdd_Click()
    
    
    'Insert vs Update options
    
    
        If Me.txtComponent.Tag & "" = "" Then
    
    
    'add, clear form, and refresh
        
        CurrentDb.Execute "INSERT INTO EntryFormTable(Assembly, Component, Description, AssemblyQty, UOM, QtyA, QtyB, QtyC, PriceA, PriceB, PriceC) " & _
        " VALUES('" & Me.txtAssembly & "','" & Me.txtComponent & "','" & Me.txtDescription & "'," & Me.numAssemblyQty & ",'" & Me.txtUOM & "'," & Me.numQtyA & "," & _
        Me.numQtyB & "," & Me.numQtyC & "," & Me.dbPriceA & "," & Me.dbPriceB & "," & Me.dbPriceC & ")"
        
        Else
        CurrentDb.Execute "UPDATE EntryFormTable " & _
            " SET Assembly='" & Me.txtAssembly & "'" & _
            ", Component='" & Me.txtComponent & "'" & _
            ", Description='" & Me.txtDescription & "'" & _
            ", AssemblyQty=" & Me.numAssemblyQty & "" & _
            ", UOM='" & Me.txtUOM & "'" & _
            ", QtyA=" & Me.numQtyA & "" & _
            ", QtyB=" & Me.numQtyB & "" & _
            ", QtyC=" & Me.numQtyC & "" & _
            ", PriceA=" & Me.dbPriceA & "" & _
            ", PriceB=" & Me.dbPriceB & "" & _
            ", PriceC=" & Me.dbPriceC & "" & _
            " WHERE Component='" & Me.frmEntrySub!Component & "'"
        End If
        
        butClear_Click
        
        frmEntrySub.Form.Requery
    
    
    End Sub

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 01-11-2014, 11:57 PM
  2. Replies: 3
    Last Post: 05-31-2013, 04:32 PM
  3. How to format a "Number" Data type
    By undee69 in forum Access
    Replies: 4
    Last Post: 12-16-2012, 10:20 PM
  4. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  5. Replies: 2
    Last Post: 05-17-2011, 02:40 PM

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