Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Recordset Not Saving Data
jannette jones 
    
6 years ago
I need help im trying to take data which is a project data once the data is approved by a suppervisor through a combo box  yes, then i want that project data inserted into a project table how can i do this?
i curently have used this 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


but it doesnt enter the data into the table not sure where the data goes it just deletes the data .
Richard Rost  @Reply  
          
6 years ago
I just briefly glanced at it for now, but one thing caught my eye... where's your Update? You need a rec2.Update call at the end to write the data to the table. And then of course don't forget your .Close and setting your variables to Nothing. You missed a couple steps. :)
Richard Rost  @Reply  
          
6 years ago
Oh, and don't always rely on the next ID in the table being  1 if it's an Autonumber, especially if you have a database that's used by multiple people.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/9/2026 11:13:48 AM. PLT: 1s