Hi i have another fairly major issue that i need to fix asap. Heres the code:
The idea behind it is that there is a meeting which has a default status of 'Open'. A meeting can have many defects. Each defect can be closed off. When all defects are closed off, the meeting status will go to 'Closed'
Now, the main question is, how can i do that?
If you look at the code above, im trying to do a do loop saying if the defect is closed (flag1 = "1") then set an variable as "1" (meetingStatus) and move on to the next record. but if the defect is open (flag1 = "0") then change meetingStatus to "0".
Now at the end, if the meeting status is "1", then meeting is closed. Now, from what i believe, the do loop isnt actually pointing to the record to find the data, its saying thats how many loops to do (depending on how many records are in the table). Am i right in saying this?
Can anyone help me with this issue please?
Many Thanks
Code:
Dim statusFlag As String
Dim response As String
Set db = CurrentDb
Set r = db.OpenRecordset("defectTable")
r.MoveFirst
Do Until r.EOF
If Forms!afterDefectViewForm2.flag1 = "1" Then
statusFlag = "1"
r.MoveNext
Else
statusFlag = "0"
Exit Do
End If
Loop
If statusFlag = "1" Then
Forms!afterViewingMeetingForm2.Flag2 = "1"
Me.Refresh
Else
Forms!afterViewingMeetingForm2.Flag2 = "0"
End If
response = MsgBox("Are you sure you wish to cancel?", vbInformation + vbYesNo)
If response = vbYes Then
DoCmd.Close
Else
End If
The idea behind it is that there is a meeting which has a default status of 'Open'. A meeting can have many defects. Each defect can be closed off. When all defects are closed off, the meeting status will go to 'Closed'
Now, the main question is, how can i do that?
If you look at the code above, im trying to do a do loop saying if the defect is closed (flag1 = "1") then set an variable as "1" (meetingStatus) and move on to the next record. but if the defect is open (flag1 = "0") then change meetingStatus to "0".
Now at the end, if the meeting status is "1", then meeting is closed. Now, from what i believe, the do loop isnt actually pointing to the record to find the data, its saying thats how many loops to do (depending on how many records are in the table). Am i right in saying this?
Can anyone help me with this issue please?
Many Thanks