Hi
Sorry to be vague in the title, im not completely sure what it falls under.
I have an issue that in theory, should work (I think) but its not. I have been sitting here for the past few hours pulling out my hair thinking hard to why it’s not working. My access isn’t that great so im sure the issue is somewhere in the coding, I just can’t seem to spot it.
Here’s the code:
I know its fairly long, put as you can see, its fairly straight forward.
Its checking to see if all the fields are filled in, it also checks two fields in a subform (the reason for the flag1's is because it only checks two records in the subform but there can be multiple records in there)
Now, the problem is, in theory, if all the fields have been filled in, all the finish1-7 will have a value "1". So at the end, if all the finish1-7 are “1”’s, it should ask if you want to save the record! but the problem is, it doesn’t! No msgbox appears when you click save (in theory, it should)
Any ideas and help will be greatly appreciated
Many Thanks
Sorry to be vague in the title, im not completely sure what it falls under.
I have an issue that in theory, should work (I think) but its not. I have been sitting here for the past few hours pulling out my hair thinking hard to why it’s not working. My access isn’t that great so im sure the issue is somewhere in the coding, I just can’t seem to spot it.
Here’s the code:
Code:
Private Sub Command45_Click()
On Error GoTo Err_Command45_Click
Dim response, response2, response3, response4, response5, response6, response7, response8
Dim finish1, finish2, finish3, finish4, finish5, finish6, finish7
If IsNull(programName) Then
response = MsgBox("Program Name not filled in", vbExclamation + vbOKOnly)
Else
finish1 = "1"
End If
If IsNull(productName) Then
response2 = MsgBox("Product Name not filled in", vbExclamation + vbOKOnly)
Else
finish2 = "1"
End If
If IsNull(phaseName) Then
response3 = MsgBox("Phase Name not filled in", vbExclamation + vbOKOnly)
Else
finish3 = "1"
End If
If IsNull(workProduct) Then
response4 = MsgBox("Work Product not filled in ", vbExclamation + vbOKOnly)
Else
finish4 = "1"
End If
If IsNull(scheduledReviewDate) Then
response5 = MsgBox("Planned Review Date not filled in", vbExclamation + vbOKOnly)
Else
finish5 = "1"
End If
If Me.participantSUBForm.Form.flag1 = "1" Then
If IsNull(participantSUBForm.Form.CDSID) Then
response7 = MsgBox("Author not filled in", vbExclamation + vbOKOnly)
Else
finish6 = "1"
End If
participantSUBForm.SetFocus
DoCmd.GoToRecord , , acNext
End If
If Me.participantSUBForm.Form.flag1 = "2" Then
If IsNull(participantSUBForm.Form.CDSID) Then
response8 = MsgBox("Leader not filled in", vbExclamation + vbOKOnly)
Else
finish7 = "1"
End If
End If
If finish1 = "1" And finish2 = "1" And finish3 = "1" And finish4 = "1" And finish5 = "1" And finish6 = "1" And finish7 = "1" Then
response6 = MsgBox("Save Work Product?", vbInformation + vbOKCancel)
If response6 = vbOK Then
workProductID2 = workProductID
meetingStatus = "Pending"
peerReviewStatus = "Open"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.Close
Else
Me.Undo
End If
Cancel = True
End If
Exit_Command45_Click:
Exit Sub
Err_Command45_Click:
MsgBox Err.description
Resume Exit_Command45_Click
End Sub
I know its fairly long, put as you can see, its fairly straight forward.
Its checking to see if all the fields are filled in, it also checks two fields in a subform (the reason for the flag1's is because it only checks two records in the subform but there can be multiple records in there)
Now, the problem is, in theory, if all the fields have been filled in, all the finish1-7 will have a value "1". So at the end, if all the finish1-7 are “1”’s, it should ask if you want to save the record! but the problem is, it doesn’t! No msgbox appears when you click save (in theory, it should)
Any ideas and help will be greatly appreciated
Many Thanks