Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Posts
    64

    Unanswered: Sql Update with 2 where conditions

    The following SQL statement with 1 where condition works fine, but the Next SQL statement with 2 where conditions does not work, a error message says Run-Time error 13 type mismatch , what is incorrect in the statement when the AND MinID = 15 is added. The table data type in set as number



    SQL = "UPDATE MinistryInv2 Set MinID = " & 14 & " WHERE PID = " & Me!ID & ";"



    SQL = "UPDATE MinistryInv2 Set MinID = " & 14 & " WHERE PID = " & Me!ID And MinID = 15 & ";"

    Peter

  2. #2
    Join Date
    Nov 2004
    Posts
    64
    Something I forgot, where the 14 is, I need to replace that with a number that would come from the first column of a combo box, I tried putting the combo62.column(0) in place of number 14, but it did not work. As you can see, I then dim XX with xx = me.combo62(0) and that did not work.

    Dim XX As Integer
    XX = Me.Combo62.Column(0)
    SQL = "UPDATE MinistryInv2 Set MinID = XX WHERE PID = " & Me!ID & " AND MinID = 15;"


    Your help will be greatly appreciated

    Phil

  3. #3
    Join Date
    Nov 2004
    Posts
    64
    I have worked it out, it is amazing how one can over look the obvious. The code should have been

    Set MinID= " & xx & "

    Thanks again

    Phil

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •