I have a Query1 with records that may or may not have a value in the property "OrdreID". The most sensible would be to open the report if all of them had the same OrdreID. If they dont have the same or if some of them doesnt have a value or if none of them have a value, i would like to make them choose whether or not to continue.
The thing i'm wondering about is the OrdreID.Value. I'm not sure what ordre really count here. Is OrdreID.Value the first element, and it counts how many records that have the same value in OrdreID as the first one?
Is there any "first" in a access-table? Does it take the first OrdreID.Value it find? I have tried to read about this in help but i dont understand it.
The thing i'm wondering about is the OrdreID.Value. I'm not sure what ordre really count here. Is OrdreID.Value the first element, and it counts how many records that have the same value in OrdreID as the first one?
Is there any "first" in a access-table? Does it take the first OrdreID.Value it find? I have tried to read about this in help but i dont understand it.
Code:
total = DCount("*", "Query1")
If Not IsNull(Query1.OrdreID.Value) Then
ordre = DCount("*", "Query1", "OrdreID = " & OrdreID.Value)
If ordre = total Then
DoCmd.OpenReport "FakturaRapport", acPreview
DoCmd.RunCommand acCmdZoom100
DoCmd.MoveSize 1000, 500, 13500, 8000
ElseIf ordre > 0 Then
strMsg = "Alle de valgte elementene har ikke samme ordrenr./Ikke alle elementene har ordrenr." & vbCrLf & vbCrLf & "Fortsette?"
If MsgBox(strMsg, vbQuestion + vbYesNo, "Vis Rapport?") = vbYes Then
DoCmd.OpenReport "FakturaRapport", acPreview
DoCmd.RunCommand acCmdZoom100
DoCmd.MoveSize 1000, 500, 13500, 8000
End If
End If
Else
strMsg = "Ingen av elementene har ordrenr." & vbCrLf & vbCrLf & "Fortsette?"
End If