gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,347
- Office Version
- 365
- Platform
- Windows
I have a Macro
If Isnull([Text123]And[Text125) Then
MessageBox
Blah Blah Blah...
Else
SetValue
Item=[ProgramListID]
Expression=[Text123]
RunCode
Function Name CreatePID
But I am getting an error message (Error Number 2766)
"This Object doesn't contain the Automation Object 'CreatePID'
I am assuming the problem is in the "RunCode" because the rest ran without problem before I added this section. I am trying to run the VBA code I have
If Isnull([Text123]And[Text125) Then
MessageBox
Blah Blah Blah...
Else
SetValue
Item=[ProgramListID]
Expression=[Text123]
RunCode
Function Name CreatePID
But I am getting an error message (Error Number 2766)
"This Object doesn't contain the Automation Object 'CreatePID'
I am assuming the problem is in the "RunCode" because the rest ran without problem before I added this section. I am trying to run the VBA code I have
Code:
Private Sub CreatePID()
'USED FOR CREATING A PID
Dim padded As String
Dim erg As Variant
Select Case 5 - Len(CStr(PID_SequenceID))
Case 4
padded = "0000" & CStr(PID_SequenceID)
Case 3
padded = "000" & CStr(PID_SequenceID)
Case 2
padded = "00" & CStr(PID_SequenceID)
Case 1
padded = "0" & CStr(PID_SequenceID)
Case Else
End Select
Me.PIDNumber = Me.ProposalIdentifier & padded & [RevisionId] & "-" & Me.ProgramListID.Column(2) & "-" & Me.JobTypeListID.Column(2) & "-" & Me.YearIdGenerated & Me.MonthIdGenerated
erg = DLookup("RFPMgr_ID", "tblRFPManager", "PID_Number='" & Me.PIDNumber & "'")
If erg > 0 Then
MsgBox "This PID already exists. Please choose other parameters!", vbCritical, Application.Name
Exit Sub
Else
SaveThisRecord
CreateRFPManagerRecord
MsgBox "New PID saved!", vbInformation, Application.Name
End If
End Sub