[AccessD] Requery a query

Kenneth Ismert kismert at gmail.com
Thu May 20 15:39:53 CDT 2010


>
> Dale_Anne Kalsow:
> ... Does anyone know how to tell the combo box's query to go and reread the
> value in the label? ...
>

Problems like this are why I long ago abandoned syncing queries with form
control values.

I use global functions instead. For your situation, I would use something
like:

Public Function Jobs_Date(Optional vDate As Variant) As Variant
    Static vParm As Variant
    If Not IsMissing(vDate) Then
        vParm = vDate
    ElseIf IsEmpty(vParm) Then
        vParm = Null     '  default
    End If
    Jobs_Date = vParm
End Function

In your query, you would put this in the Criteria row for the field:
    =Jobs_Date()

In the form, you would use:
   Jobs_Date me.lblDate.Caption
   me.Combo0.Requery

This works perfectly, and is extremely flexible.

For small Access projects, I do all of my form/query/report synchronization
like this.

-Ken



More information about the AccessD mailing list