Filtering

  • Hi ,

    I'm trying to use a command button to filter the current form.

    When clicked on it should show all records where the discharge box is not ticked .

    This box is also on the form  -  i tried to get data when the value is 0.

    HELP

     

    filteringStr = filteringStr & "qryNotDischarged.Discharged_  ='" & Me.Discharged_.Value = 0 & "'"

     

    Regards

    Ritesh

  • Can you post the full content of filteringstr?

    debug.print filteringStr

    a guess

    if Me.Discharged_.Value = 0 then

    if filteringStr="" then

    filteringStr =qryNotDischarged.Discharged=0

    else

    filteringStr = filteringStr & " AND qryNotDischarged.Discharged=0"

    end if

    else

    end if

     

  • Put a breakpoint after those lines and will see your quotes are in the wrong place.

    Me.Discharged_.Value = 0

    Evaluates to True or False. If discharged is a number then you don't need the quotes at all

  • I'm assuming that your back-end data is in SQL Server.  If Discharged is a Yes/No field in Access you would just want to either have "AND Discharged" or "AND NOT Discharged" depending on the status of the checkbox.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply