Solved

Clear Form

Posted on 2014-01-17
4
508 Views
Last Modified: 2014-01-23
I've created a entry/view form.  I would like this form to always come up empty.  So I add this event code

Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
End Sub

It doesn't seem to always work.  On the first new input record it seems to works...but after that it doesn't seem to work.  

Any and all comments are welcomed?
0
Comment
Question by:EASCOA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 30

Accepted Solution

by:
hnasr earned 500 total points
ID: 39790523
You may change the default property in design view: What? Data Entry: Yes

How?
Form properties sheet > Data tab > Data Entry: Yes
0
 
LVL 85
ID: 39792077
When you say "blank record", what exactly are you referring to? Do you want the form to open ready for entering a new record, or do you want the form to open and allow the user to search for an existing record?

-- If you want to open to a new record, then the Data Entry method suggested by hnasr may be the easiest way. Note that this can sometimes cause blank/unfilled/empty records to be recorded in the table, which can be troublesome to deal with, so be sure to also include code to validate the form before it's saved.

-- If you want to allow users to search for an existing record, then set the Form's Recordsource to show no records:

SELECT * FROM MyQueryOrTable WHERE 1=0

This will still "bind" the form, but you could then include controls and code to allow the user to locate a specific record, or to add a new record.
0
 
LVL 15

Expert Comment

by:JimFive
ID: 39794620
The Form_Load() event only occurs when the form is first loaded.

It sounds to me like you are wanting the user to see only the "New" record.  Using Data Entry mode, as suggested above will not show existing records, but will show all of the records that were entered during the current session.

You can use Me.Requery in the vba code of the OnCurrent event to hide the newly entered records.

You could attempt to put the DoCmd.GotoRecord in the OnInsert event, but this can cause problems as Access will sometimes insert the record before you think it should, especially when using subforms.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Familiarize people with the process of utilizing SQL Server views 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 Access…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

729 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