CurrentDb.Execute Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MitchR
    New Member
    • Oct 2006
    • 65

    CurrentDb.Execute Problem

    Hello Folks;

    I have run myself into a hole I cannot get of and need some assistance. I have a Form "Frm_ATandT_Act ivation_Center" that has a sub form "Frm_ATandT_Act ivation". Frm_ATandT_Acti vation_Center is standard in Form View with no Master or Child links to the Sub form. this allows me to show available SIM ID"S in inventory for activation. The Subform diplays as a datasheet that has a Query as the control source. So when the user opens the form as a whole they see the listing of available SIM ID"S and 2 textbox controls to enter a remedy ticket number and an Employee ID. I am also Capturing the date and the employee's user name that activates the SIM. I have everything working except the CurrentDb.Execu te statement to matchup all the entered data to the SIM that is being activated. here is my after update event of a combo box that the user chooses that corresponds with the SIM number to be activated.
    Code:
    Code:
    Private Sub Text1_AfterUpdate()
    Dim strSim As String
    Dim strRemedy_Num As String
    Dim strEID As String
    Dim strUser As Variant
    Dim varRespond As Variant
    Dim strSQL As String
    Set Db = CurrentDb
    stDocName = "Frm_AtandT_Activation_Center"
    varSim = Me.SIM
    varUser = fOSUserName
    varEID = Forms.Frm_ATandT_Activation_Center.EID
    varRemedy = Forms.Frm_ATandT_Activation_Center.Remedy_num
    varUser = Forms.Frm_ATandT_Activation_Center.Text18
    Date = Forms.Frm_ATandT_Activation_Center.Used
        Respond = MsgBox("Are you Ready to issue this Sim -->" & varSim & " <-- to a Hand Held Device? " & _
                    "Using Remedy Number " & varRemedy & vbCrLf & _
                    " Employee ID Number " & varEID & " ?", vbYesNo, "Ready to Complete Activation? ")
    If Respond = vbYes Then
          
          CurrentDb.Execute "UPDATE tbl_SimInventory SET [Used] = " & Date & " , SET [UserNam] = " & varUser & " , 
     Set [Remedy_Num] = " & varRemedy & ", Set [EID] = " & varEID & " WHERE SIM = " & Me.SIM_list
    
    
        DoCmd.Close
        DoCmd.OpenForm stDocName, acNormal, , , , acWindowNormal
    
       
    If Respond = vbNo Then
           MsgBox "You may complete any changes needed for this activation", , " No Worries! "
    Forms.Frm_ATandT_Activation_Center.Used = Null
    Forms.Frm_ATandT_Activation_Center.Remedy_num = Null
    Forms.Frm_ATandT_Activation_Center.EID = Null
    Forms.Frm_ATandT_Activation_Center.UserNam = Null
    Me.Text1 = "Inventory"
    End If
    End If
    End Sub

    My main goal is to fix my CurrentDb.Execu te to enter the data to the corresponding SIM ID
    Thank you so very much for your help.
  • FishVal
    Recognized Expert Specialist
    • Jun 2007
    • 2656

    #2
    Hi, Mitch.

    SQL statement you pass to Execute method contains numerous syntax errors. I suggest you to create it and test in query design to get a working one.

    And, just out of curiosity, was that a bad idea to insert records via bound form?

    Regards,
    Fish

    Comment

    Working...