Solved

Clear Form

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

707 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