Link to home
Create AccountLog in
Avatar of jeannie Jones
jeannie JonesFlag for United States of America

asked on

error running code

Private Sub cmdMove_Click()
'DoCmd.Save
Dim db As DAO.Database
Dim rec As DAO.Recordset
Dim rec2 As DAO.Recordset
Dim ProjNorec As Integer
Set db = CurrentDb
Set rec = db.OpenRecordset("PLC_PCR_Temp", dbOpenDynaset, dbSeeChanges)
Set rec2 = db.OpenRecordset("TrackerProjectNo", dbOpenDynaset, dbSeeChanges)
  If IsNull(Me.TEstimateCompleteDate) Then
         If Me.TProjectApproved <> "Yes" Then
            MsgBox " Please enter the due date and Yes option in approved field before approving...", vbOKOnly, "New Project to be approved"
            Me.TEstimateCompleteDate.SetFocus
         Else
            MsgBox " Please enter the due date before approving...", vbOKOnly, "New Project to be approved"
            Me.TEstimateCompleteDate.SetFocus
         End If
    Else
        If Me.TProjectApproved = "Yes" Then
        rec2.MoveLast
       recid = rec2("ProjectID")
       recid = recid + 1
        rec2.AddNew
        rec2("ProjectNo") = ""
        rec2("DateSubmitted") = Me.TSubmittedDate
        rec2("DateEntered") = ""
        rec2("TechAssigned") = Me.TAssignedTechnician
        rec2("Requestor") = Me.TRequestor_Name
        rec2("Department") = Me.TDepartment
        rec2("Manager") = Me.TDepartmentManager
        rec2("ContactNo") = Me.TContactPhoneNo
        rec2("AreaAffected") = Me.TAreaAffected
        rec2("ProjectOverview") = Me.TProjectApproved
        rec2("Notes") = Me.TTechnicianNotes
        rec2("DueDate") = Me.TEstimateCompleteDate
        rec2("CompletedDate") = Me.TCompletedDate_Time
        rec2("TestDate") = Me.TTestDate
        rec2("ProdDate") = Me.TCompletedDate_Time
        rec2("ProjectApproved") = Me.TProjectApproved
        rec2("ProjectStatus") = Me.TCapaStatus
       
        If Not (fDelCurrentRec(Me)) Then
           MsgBox " New Project Request has been Approve...", vbOKOnly, "New Project"
           Me.TempCapaNo.SetFocus
           TAssignedTechnician.Enabled = False
           TSubmittedDate.Enabled = False
           TRequestor_Name.Enabled = False
           TDepartment.Enabled = False
           TAFENo.Enabled = False
           TAFE_Hours.Enabled = False
           TProjectApproved.Enabled = False
           TAreaAffected.Enabled = False
           TProjectSummary.Enabled = False
           TCAPANo.Enabled = False
           TDepartmentManager.Enabled = False
           TContactPhoneNo.Enabled = False
           TReqCompletedDate.Enabled = False
           TEstimateCompleteDate.Enabled = False
           TCapaStatus.Enabled = False
           TProjectDetails.Enabled = True
           TTechnicianNotes.Enabled = False
      End If
   Else
     
     
     MsgBox " This project has not been approved. Please Choose YES...", vbOKOnly, "Approved Project"
     
     Me.TempCapaNo.SetFocus
     Me.Requery
     Me.Refresh
  End If
End If

End Sub
Avatar of Norie
Norie

What's the error and where in the code does it occur?
Avatar of jeannie Jones

ASKER

it not doing what i need it to do i need it to take a project once a supervisor hits approve button and move the record to the Tracker Project No table now it doesnt do anything but delete the record
PLC_PCR1.zip
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account