• Where criteria depends on a form's text control

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Where criteria depends on a form's text control

    • This topic has 2 replies, 2 voices, and was last updated 16 years ago.
    Author
    Topic
    #459480

    I need to add a where clause to the following statement. The criteria needs to be < the value (date) in forms!frmPaSu!txtDt, if there is one. Needs to return all records if there is no user entered value in the text box.

    SELECT tblTest.lngTestID, tblTest.strTestTypeK, tblTest.lngVehID, tblTest.dtmDtTmS AS dtmCurDt, tblTest.strPurposeK
    FROM tblTest;

    Need some help.

    Viewing 0 reply threads
    Author
    Replies
    • #1158625

      I need to add a where clause to the following statement. The criteria needs to be < the value (date) in forms!frmPaSu!txtDt, if there is one. Needs to return all records if there is no user entered value in the text box.

      SELECT tblTest.lngTestID, tblTest.strTestTypeK, tblTest.lngVehID, tblTest.dtmDtTmS AS dtmCurDt, tblTest.strPurposeK
      FROM tblTest;

      Need some help.

      Try this

      Where (((tblTest.dtmDtTmS)<[Forms]![frmPaSu]![txtDt])) OR (([Forms]![frmPaSu]![txtDt] Is Null))

      • #1158626

        Try this

        Where (((tblTest.dtmDtTmS)<[Forms]![frmPaSu]![txtDt])) OR (([Forms]![frmPaSu]![txtDt] Is Null))

        Nailed it. Thanks

    Viewing 0 reply threads
    Reply To: Where criteria depends on a form's text control

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: