S
State Troopers
Hi there,
I am need of some coding help.
In the following code I am trying to look through a predetermined table, and
then look for A certain record which matches the specific criteria.
------
CloseCat = "Closed"
strType = "1"
rsMyRS.MoveFirst
Do Until rsMyRS.EOF
If rsMyRS.Fields!DIR = strDir And rsMyRS.Fields!CAT = strType And
rsMyRS.Fields!CLOSE = CloseCat Then '(3)
cmdClose.Enabled = False
rsMyRS.EOF
Else
cmdClose.Enabled = True
rsMyRS.MoveNext
End If
Loop
The problem I have is that I cant stop the loop when it reaches the record
I want. There cannot be more than one of the "wanted" records.
If the data matches the DIR #, the Catagory, and the Close Catagory then I
want it to disable the command button and stop running the loop.
Since there is only 1 record which matches this criteria and is not in most
cases the last record the loop finishes with the "Else" statement, enabling
the command button..even though the record may exist.
Thanks in advance.
-State
I am need of some coding help.
In the following code I am trying to look through a predetermined table, and
then look for A certain record which matches the specific criteria.
------
CloseCat = "Closed"
strType = "1"
rsMyRS.MoveFirst
Do Until rsMyRS.EOF
If rsMyRS.Fields!DIR = strDir And rsMyRS.Fields!CAT = strType And
rsMyRS.Fields!CLOSE = CloseCat Then '(3)
cmdClose.Enabled = False
rsMyRS.EOF
Else
cmdClose.Enabled = True
rsMyRS.MoveNext
End If
Loop
The problem I have is that I cant stop the loop when it reaches the record
I want. There cannot be more than one of the "wanted" records.
If the data matches the DIR #, the Catagory, and the Close Catagory then I
want it to disable the command button and stop running the loop.
Since there is only 1 record which matches this criteria and is not in most
cases the last record the loop finishes with the "Else" statement, enabling
the command button..even though the record may exist.
Thanks in advance.
-State