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 
Blank Form with Zero Records
Robert Sena 
    
4 years ago
I built an access database is working great.  I deleted all the dummy records so I can populate with an active project.  When I deleted all the old records and went back into the form, it is blank. The code is as follows.  How would I modify the code to show the form with 0 records so I can begin populating?


VBA Script below:

Option Compare Database
Option Explicit


Private Sub Form_Current()

End Sub

Private Sub ProjectMaterialID_AfterUpdate()

ActualQty = [ProjectMaterialID].[Column](3)
ActualPrice = DLookup("[UnitPrice]", "[projectmaterialsT]", "[ProjectItemID] = " & [ProjectMaterialID])

End Sub




'------------------------------------------------------------
' btnAdd_Click
'
'------------------------------------------------------------
Private Sub btnAdd_Click()
On Error GoTo btnAdd_Click_Err


Me.AllowAdditions = True
Me.EmployeeID.Enabled = True

    On Error Resume Next
    DoCmd.GoToRecord , "", acNewRec
    Me.EmployeeID = curUserId
    Me.EmployeeID.Enabled = False
    Me.ProjectID.SetFocus
    Me.btnSave.Enabled = True
    
    
btnAdd_Click_Exit:
    Exit Sub

btnAdd_Click_Err:
    MsgBox Error$
    Resume btnAdd_Click_Exit

End Sub


Private Sub btnEdit_Click()



If curUserId <> Me.EmployeeID And UserLevel <> 1 Then
MsgBox txtCurUser + ", you can not edit someone else's report", vbCritical, dbTitle
Exit Sub
End If

Me.AllowEdits = True
Me.AllowAdditions = True
Me.ProjectID.SetFocus
Me.btnSave.Enabled = True


End Sub

Private Sub btnFind_Click()
'
'DoCmd.Close
'
'
'DoCmd.OpenForm "finddwreportF"


End Sub

Private Sub DailyWorkAccepted_Click()

'If UserLevel <> 1 Then
'MsgBox "This can only be updated by DB Admin", vbCritical, BusName
'Exit Sub
'End If
'
'Me.DailyWorkAccBy = txtCurUser + " - " + Str(Date)
'
'btnSave_Click


End Sub



Private Sub Form_Load()


DoCmd.Maximize


Me.AllowAdditions = False
Me.AllowEdits = False
Me.btnSave.Enabled = False




End Sub
'------------------------------------------------------------
' btnClose_Click
'
'------------------------------------------------------------
Private Sub btnClose_Click()
On Error GoTo btnClose_Click_Err

DoCmd.Close


    DoCmd.OpenForm "MainMenuF", acNormal, "", "", , acNormal


btnClose_Click_Exit:
    Exit Sub

btnClose_Click_Err:
    MsgBox Error$
    Resume btnClose_Click_Exit

End Sub


'------------------------------------------------------------
' btnSave_Click
'
'------------------------------------------------------------
Private Sub btnSave_Click()
On Error GoTo btnSave_Click_Err

    On Error Resume Next
    DoCmd.RunCommand acCmdSaveRecord
    If (MacroError <> 0) Then
        Beep
        MsgBox MacroError.Description, vbOKOnly, ""
    End If

Me.btnSave.Enabled = False

MsgBox "Saved", vbInformation, BusName

Me.AllowAdditions = False
Me.AllowEdits = False
Me.btnSave.Enabled = False

btnSave_Click_Exit:
    Exit Sub

btnSave_Click_Err:
    MsgBox Error$
    Resume btnSave_Click_Exit

End Sub



Alex Hedley  @Reply  
           
4 years ago
Not sure how the code will help at this point, lots of steps you could try first.

What's the Record Source of the Form in question?

How did you clear out of the data? Directly in the Table?
If you manually add a record in the Table does it show in the form.

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: 6/27/2026 1:27:39 AM. PLT: 1s