I've been reading ya'lls threads on 2501 Open Form errors. I have been trying to implement what solutions I can (trying to modify them to fit my needs - obviously not well enough) and am still getting this error. Other errors make sense and are easy to fix, this one almost seems illogical. I do not have a VBA background, but have background in Java, JavaScript, webdesign, and MatLab... Let's just say I'm thoroughly confused.
I am trying to make sure people don't duplicate errors and freak out the macros in the database of report review status. Basically I want to perform a logical comparison of the report number (PI) to the entire table of report nubmers and if it duplicates a record, go to that record for editing (in the same form).
Any help on this would be greatly appreciated.
(code follows)
***************
Private Sub PI_AfterUpdate()
pinumber = DLookup("PI", "Report_Status", strPI)
If Not IsNull(pinumber) Then
'do this
'Message box warning of duplication
MsgBox "Review Status for PI # " _
& PI & " already exists." _
& vbCr & vbCr & "You will now been taken to the record.", _
vbInformation, "Duplicate Entry"
'Take User to record for editing
'Dim stDocName As String
'Dim stLinkCriteria As String
'stDocName = "Edit_Review_Status"
'stLinkCriteria = "[PI]=" & Me![PI] & ""
'stLinkCriteria = "PI = Me![PI]"
DoCmd.OpenForm "Edit_Review_Status", , , "[Edit_Review_Status]![PI]=" & Me![PI]
End If
End Sub
***************
I am trying to make sure people don't duplicate errors and freak out the macros in the database of report review status. Basically I want to perform a logical comparison of the report number (PI) to the entire table of report nubmers and if it duplicates a record, go to that record for editing (in the same form).
Any help on this would be greatly appreciated.
(code follows)
***************
Private Sub PI_AfterUpdate()
pinumber = DLookup("PI", "Report_Status", strPI)
If Not IsNull(pinumber) Then
'do this
'Message box warning of duplication
MsgBox "Review Status for PI # " _
& PI & " already exists." _
& vbCr & vbCr & "You will now been taken to the record.", _
vbInformation, "Duplicate Entry"
'Take User to record for editing
'Dim stDocName As String
'Dim stLinkCriteria As String
'stDocName = "Edit_Review_Status"
'stLinkCriteria = "[PI]=" & Me![PI] & ""
'stLinkCriteria = "PI = Me![PI]"
DoCmd.OpenForm "Edit_Review_Status", , , "[Edit_Review_Status]![PI]=" & Me![PI]
End If
End Sub
***************