Results 1 to 4 of 4

Thread: [RESOLVED] Select with multiple conditions

Threaded View

  1. #1

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Resolved [RESOLVED] Select with multiple conditions

    I have some code where this works fine

    Code:
    With rs
        .Open "SELECT * FROM Requests where RequestType = '" & Cells(Target.Row, 1) & "'", cn, adOpenKeyset, adLockOptimistic, adCmdText
        
        .Fields("Status").Value = Cells(Target.Row, 4).Value
        .Fields("Notes").Value = Cells(Target.Row, 6).Value
        .Update
    End With
    I'm trying to add a second condition and the syntax is wrong. What's my mistake?

    Code:
    .Open "SELECT * FROM Requests where RequestType = '" & Cells(Target.Row, 1) & "' AND DateCreated = '" & cells(target.Row, 2) & "'", cn, adOpenKeyset, adLockOptimistic, adCmdText

Posting Permissions

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



Click Here to Expand Forum to Full Width