No Execute on Send Selected record To Another Table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • natural
    New Member
    • Aug 2007
    • 21

    No Execute on Send Selected record To Another Table

    Good Morning

    I have an unbound form "FrmInterviewSu ccesfful" with some unbound fields on it
    There is also an option box with 3 options and by clicking on it
    my subform wil filter with Sucessfull/Unsucessful and all Candiates

    Works Perfectly..

    In my subform i have the id some extra info about the candidate and then a tick box calles MoveToOffer.

    1 or Multiple records might be selected(ticked ) to be moved to TblOffer...

    I then placed a command button on the frm to move all the selected records to my "offer table "

    My problem, I want only the selected records to be moved, and missing something i have the following code

    Code:
    Dim iAnswer As Integer
    
    iAnswer = MsgBox("Only selected Candiates wil be send to the Offer Table", vbCrLf & vbOK)
            
                 
    DoCmd.SetWarnings (False)
    
    currentdb.Execute "INSERT INTO tblOffer SELECT * FROM TblCandidates  " & _  " WHERE [ID] = " & Forms![frmhome]![frmContent].[Form].FrmInterviewSuccessfullsub.ID  
    And [SendToOffer] = -1, dbFailOnError
     
    currentdb.Execute "DELETE * FROM TblCandidates " & _
    " Where [ID] = " & Forms![frmhome]![frmContent].[Form].FrmInterviewSuccessfullsub.ID  
    And [SendToOffer] = -1,dbFailOnError
    
    
    Forms![frmhome]![frmContent].[Form].Requery
    DoCmd.SetWarnin gs Truei get my message and that is it.. not execution is happening..


    I have also removed the dbfailonerro. but then get an
    Runtime 438
    Object does not support propery or method.


    is my statement correct.. for a yes field it is -1


    Can anyone possibly assist in where i might be going wrong

    Thank you very much in advance
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    At lines 9 and 13 the 'And's are no longer part of the SQL strings you are trying to execute.

    This should not even compile - it helps you in debugging to compile code first. The compiler should fail with a syntax error on these lines.

    -Stewart

    Comment

    Working...