Hello,
I'm currenlty creating an Access module that will search through a particular customers records (Gas metering)history and if the record per meter has a null date, then populate with the original date.
However I am trying to use a select case statement, but for some reason it doesn't seem to work for multiple additional test criteria.
The help menu's example shows when one variable is being tested which doe not help me.
Is there a way to test combinations of different variables in a select case statement, or can it only be done testing one at a time.
The code as it stands is
As you can see as well as testing M, there are other influencing factors.
P.S - i have already tried using 'And', but this cut no ice.
I hope someone out there can help me????
OOch
I'm currenlty creating an Access module that will search through a particular customers records (Gas metering)history and if the record per meter has a null date, then populate with the original date.
However I am trying to use a select case statement, but for some reason it doesn't seem to work for multiple additional test criteria.
The help menu's example shows when one variable is being tested which doe not help me.
Is there a way to test combinations of different variables in a select case statement, or can it only be done testing one at a time.
The code as it stands is
Code:
Do While Not rs.EOF 'loop from 1st row last row
CS = Nz(rs![NA_Ctrt_STATUS], ""): E = rs![Effective From Date]: M = rs![meterpointref]: S = Nz(rs![siterefnum], "") ' store rs refs
E2 = Nz(rs2![Effective From Date]): M2 = rs2![meterpointref]: S2 = Nz(rs2![siterefnum], ""):
Select Case M
Case Is = M2, (rs.AbsolutePosition + 1) <> rsEnd, F <> True, IsNull(E2) = True
Edt = rs![Effective From Date].Value: F = True: rs2.MoveNext
Case Is <> M2, (rs.AbsolutePosition + 1) <> rsEnd
Select Case F
Case Is = True
rs.Fields("effective from date") = Edt: rs.Update: rs2.MoveNext: F = False
Case Is = False
rs2.MoveNext
End Select
Case Is = M2, (rs.AbsolutePosition + 1) = rsEnd, E2 = ""
Select Case F
Case Is = True
rs2.Fields("effective from date") = Edt: rs2.Update: rs2.MoveLast
Case Is = False
rs2.Fields("effective from date") = rs![Effective From Date].Value: rs2.Update: rs2.MoveLast
End Select
Case Is <> M2, (rs.AbsolutePosition + 1) = rsEnd, E2 = "", F = True
rs2.Fields("effective from date") = Edt: F = False: rs2.MoveLast: rs2.Update
End Select
rs.MoveNext
Loop
As you can see as well as testing M, there are other influencing factors.
P.S - i have already tried using 'And', but this cut no ice.
I hope someone out there can help me????
OOch