update query error 3078

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Knowlton
    New Member
    • Feb 2011
    • 75

    update query error 3078

    I have update queries in a select case statement. In case 1 the two queries work fine but in case 5 the code breaks at the first query giving the Error 3078 - The Microsoft Jet database engine cannot find the input table or query ".
    I can see no difference between the queries other than word differences. Can someone see something I'm missing?
    Code:
    Case 1
    query 1
     Dim strSQL As String    'set discard to true and InService to False for OldTire in the tires table
                            strSQL = _
                                "UPDATE tblTires " & _
                                "SET tblTires.Discarded = True, tblTires.InService = False, tblTires.StockStatus = ""UnServicable"" " & _
                                "WHERE (((tblTires.TireID) =" & intOldTire & "));"
                    
                        CurrentDb.Execute strSQL, dbFailOnError
    
    query 2
    Dim strInService As String      'set New Tire InService to True
                            strInService = _
                                "UPDATE tblTires " & _
                                "SET tblTires.InService = True, tblTires.Discarded = False, tblTires.StockStatus = ""In Service"" " & _
                                "WHERE (((tblTires.TireID) =" & intNewTire & "));"
                    CurrentDb.Execute strInService, dbFailOnError
    
    case 5
    query 1
    Dim CapStock As String         'set InService to False
                        CapStock = _
                            "UPDATE tblTires " & _
                                "SET tblTires.Discarded = False, tblTires.InService = False, tblTires.StockStatus = ""Retread Stock"" " & _
                                "WHERE (((tblTires.TireID) =" & intOldTire & "));"
                    CurrentDb.Execute RemoveToStock, dbFailOnError
    
    query 2
    Dim strInService5 As String                         'set New Tire InService to True
                        strInService5 = _
                            "UPDATE tblTires " & _
                            "SET tblTires.InService = True, tblTires.Discarded = False, tblTires.StockStatus = ""In Service"" " & _
                            "WHERE (((tblTires.TireID) =" & intNewTire & "));"
                    CurrentDb.Execute strInService2, dbFailOnError
  • Luk3r
    Contributor
    • Jan 2014
    • 300

    #2
    I may be way off here, but in query 1 of case 5 aren't you trying to execute a command (string) that doesn't exist? Shouldn't you be executing CapStock instead of RemoveToStock? The same goes for query 2 of case 5.

    Comment

    • Knowlton
      New Member
      • Feb 2011
      • 75

      #3
      Yes you are right. I was focusing on the query and didn't see that.
      Thanks

      Comment

      • Luk3r
        Contributor
        • Jan 2014
        • 300

        #4
        You're welcome and I'm glad I could help.

        Comment

        Working...