Solved

Table Bound to a Form - MS Access

Posted on 2016-10-18
6
41 Views
Last Modified: 2016-10-20
I have an Access database with a bound form.   The form is used for adding records to a table. It has a bunch of textboxes and comboboxes on it for data entry. After the user enters required data into the boxes, (s)he clicks a command button to add a record.

Currently, when the form is opened, the boxes are populated with data from the first record in the table.  I do not want this.  I want all boxes to be empty upon opening/activating the form. How can I accomplish this?
0
Comment
Question by:dbfromnewjersey
  • 3
  • 2
6 Comments
 
LVL 75
ID: 41849036
Set the Form Data Entry property to Yes.
This will allow only adding New Records ...and open the Form to a blank, new record.
0
 

Author Comment

by:dbfromnewjersey
ID: 41849078
But wait.  I'm going to be using the form to allow the user to scroll through already-entered records to update or delete them if they so choose. Your comment says setting it that way will only allow New Records.
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 41849097
Sorry ... I misread I guess.
So that will not work.

I guess you can do this:
In the Form Load event ....
Private Sub Form_Load()
    DoCmd.RunCommand acCmdRecordsGoToNew
End Sub
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:dbfromnewjersey
ID: 41850281
Causes an error on the Load and Activate events but works on the Open event. I'll take it! Thanks.
0
 
LVL 75
ID: 41850615
Private Sub Form_Load()
    On Error Resume Next
    DoCmd.RunCommand acCmdRecordsGoToNew
    On Error Goto To 0  'reset
End Sub

You could ... put in more error handling here, but this covers the two cases above.
0
 
LVL 31

Expert Comment

by:Helen_Feddema
ID: 41852428
Another option is to make a record with all blank values (or dummy values), if you can get the key field to be first in the order of the form's record source.  This can be useful if you have users who tend to open a form and start typing in it, without first selecting the appropriate record.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now