View Single Post
Old 06-01-2017, 07:54 AM   #6
Newly Registered User
Join Date: Nov 2015
Posts: 823
Thanks: 4
Thanked 194 Times in 180 Posts
static will become famous soon enough static will become famous soon enough
Re: Record counter at button Next/Previous

So the form is made up of 25 sub forms.
And the sub form contains a procedure called setContent which sets the recordsource from sql based on a date and group

Sub setContent(pDate As Date, pGroup As Long)
    datum = pDate
    gruppe = pGroup
    RecordSource = sql(datConvert(pDate), pGroup)
End Sub
So you can use the WHERE

Function sqlWHERE(pDatum As String, pGruppe As Long) As String
    sqlWHERE = "IIf(IsNull([datMessungSoll]),arbeitstageAddieren([datEinarbeitIst],getKPI('Messung', False)),[datMessungSoll]) = #" & pDatum & "# AND IIf(IsNull([indAbweichendeMessanlage]),[qryBelegungMessanlage].[lngGruppe],[tblMessanlage].[lngGruppe]) = " & pGruppe & " AND ISNULL(datMessungIst) AND (NOT ISNULL(datEinarbeitSoll) OR NOT ISNULL(datEinarbeitIst) OR NOT ISNULL (datMessungSoll))"
End Function
but you'd need to pass in a date range and use BETWEEN in the SQL

[datMessungSoll] between #" & pDatumfrom & "# AND #" & pDatumto & "#
static is offline   Reply With Quote