Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    Posts
    157

    Unanswered: Filter VBA Code help

    I am trying to write some VBA code that gives the same effect as the the following:

    FILTER: (((aStaffTrainingQ.TrainingStage)<>"Completed Training" And (aStaffTrainingQ.TrainingStage)<>"Pre Employment Training"))

    The following code works in part, in that it gives all records except Completed training (but it still gives records with Pre Employment Training). I want all record except Completed Training and except Pre Employment Training.

    Can you help me with the correct code?



    Private Sub Form_Open(Cancel As Integer)

    On Error GoTo Err_Form

    Dim db As DAO.Database
    Dim rs As DAO.Recordset

    Me.Filter = "TrainingStage <> 'Completed Training' and 'Pre Employment Training'"
    Me.FilterOn = True

    Exit_Form:
    Exit Sub

    Err_Form:
    MsgBox Error$
    Resume Exit_Form
    End Sub

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Me.Filter = "TrainingStage <> 'Completed Training' and TrainingStage <> 'Pre Employment Training'"
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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