Solved

Clear Form

Posted on 2014-01-17
4
506 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 84
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

749 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