Form Public Property Used As Criteria in unbound field query RRS feed

  • Question

  • First time posting a question. I have inherited an Access 2003 application and am working on converting it to Access 2016 and am having a problem with a form property being used as a query parameter. I have a form module with the following Declarations section:

    Option Compare Database
    Option Explicit

    Private frmCopyOption As Form_frm_Setup_CopyOption
    Private frmOptions As Form_frm_Setup_Revisions_Options

    Private frmPlans As Form_frm_Setup_Revisions_Plans
    Private frmLSI As Form_frm_Setup_PlanLumpSumSheet
    Private frmRevenue As Form_frm_Setup_PlanRevenuesSheet

    Private frmAdjust As Form_frm_Setup_LaborAdjust

    Private priLocked As Boolean

    Private priSetup As Boolean

    and the following code:

    Public Property Get CurPlanRevisionid() As Long
        CurPlanRevisionid = Nz(lst_Elevations.Column(4), 0)
    End Property

    The form has an unbound List Box named lst_PlanPhases that uses a SELECT SQL statement as its record source, with one of the fields having [curPlanRevisionid] as the criteria.

    lst_Elevations is an unbound list box on the same form that uses another SQL statement as its record source.

    In Access 2003 lst_PlanPhases populates correctly, but in Access 2016 it doesn't recognize curPlanRevisionid and asks the user to Enter Parameter Value, instead of getting it from the Public Property in the form module.

    I'm guessing something is not being declared properly, or the Public Property is not being used properly, and Access 2003 was more forgiving than 2016. I don't have enough experience to understand what the problem is and how to solve it.

    Thanks for your assistance.

    Thursday, January 25, 2018 12:50 AM