UPDATE/SET execution in VBA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmprescott
    New Member
    • Jul 2009
    • 41

    UPDATE/SET execution in VBA

    I'm trying to transition from .net to VBA and hating life!

    I'm getting an error when I try this: Too few parameters. Expected 1.
    Does anyone know what I'm doing wrong?

    Code:
    If Status = "Closed" Then
            If GeneralThoughts = Null Then
                MsgBox ("Enter reason for closing concern")
                Exit Sub
            End If
            
            db.Execute "UPDATE Issues" & vbCrLf & "SET ClosedDate=Date()" & vbCrLf & _
            "WHERE ConcernURL=" & ConcernURL
        End If
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Code:
    If Status = "Closed" Then
      If GeneralThoughts = Null Then
        MsgBox ("Enter reason for closing concern")
          Exit Sub
      End If
      
      'Assuming ConcernURL is a String
      CurrentDb.Execute "UPDATE Issues " & _
                        "SET ClosedDate = Date() WHERE ConcernURL='" & _
                         ConcernURL & "';", dbFailOnError
    End If
    Last edited by NeoPa; Oct 26 '09, 12:41 AM. Reason: Removed Quote for Best Answer.

    Comment

    • jmprescott
      New Member
      • Jul 2009
      • 41

      #3
      Oh geez, quotes lol

      tyvm

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        VBA syntax for

        If GeneralThoughts = Null Then

        would be

        If IsNull(me.Gener alThoughts)l Then

        Also, what event are you using this code in?

        Comment

        • jmprescott
          New Member
          • Jul 2009
          • 41

          #5
          Issue resolved, thanks!

          Comment

          Working...