Results 1 to 3 of 3
  1. #1
    Jackie is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    15

    INSERT INTO problem

    Hi all



    I am trying to use INSERT INTO to move data from one table to another but can get it to work

    Code:
    Public Sub cmdcomplete_Click()
      
      If Me.StockFittedID.Enabled = True Then 
        MsgBox "There must be at least one stock item per line"
      Else:
          
        Dim Message, Buttons, Choice
          Message = "Are you sure you want to complete?"
          Buttons = vbYesNo
          Choice = MsgBox(Message, Buttons)
        
          If Choice = vbNo Then
            Exit Sub
        
        Else:
        
      Dim db As Database
      Set db = CurrentDb()
          db.Execute "INSERT INTO StockFitted SELECT StockFittedTemp.StockFittedID, StockFittedTemp.JobID," & _
                    "StockFittedTemp.StockID, StockFittedTemp.Quantity, StockFittedTemp.DateFitted," & _
                    "StockFittedTemp.InvoicedPrice, StockFittedTemp.TotalPrice, FROM StockFittedTemp"
            
          db.Execute "DELETE * FROM StockFittedTemp"
          
            Me.subformcontainer.Requery
            
            Me.txttotal.Requery
          Set db = Nothing
        End If
      End If
    End Sub
    Can anyone see where I'm going wrong?

    Cheers

    Jackie

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Maybe this link will help: http://allenbrowne.com/ser-37.html

  3. #3
    Jackie is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    15
    cheers RuralGuy I will have a look at
    Thanks
    Jackie

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

Similar Threads

  1. INSERT query: insert new data only
    By drh in forum Access
    Replies: 2
    Last Post: 04-04-2014, 05:31 PM
  2. New insert row
    By khparhami in forum Access
    Replies: 5
    Last Post: 09-06-2010, 10:37 AM
  3. SQL Insert into
    By jamin14 in forum Programming
    Replies: 15
    Last Post: 04-01-2010, 12:35 AM
  4. help with insert
    By jamie in forum Access
    Replies: 1
    Last Post: 11-16-2009, 06:02 AM
  5. automatic row insert
    By Jerry8989 in forum Forms
    Replies: 7
    Last Post: 09-29-2009, 06:50 AM

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