Solved

Clear Form

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

Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
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.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

615 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