Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open form to blank fields

Status
Not open for further replies.

KerryL

Technical User
May 7, 2001
545
US
Probably an easy solution to this, but so far I haven't been able to figure it out.

When I open the form where I enter customer information, I don't want data from the first record (or most recent) to show up on the form.

Which property do I set to make sure the form opens up blank, all ready for a new record to be entered?

Thanks in advance for your help,
Kerry
 
There isn't one.

But you can create a Add new record button which will do that. I prefer that Add new button cause I can do other stuff when they add a new record like making the date = today. Or setting other default options.

Me!Date = format(now,"mm/dd/yy")

One reason there is not an option to add a new one is everytime you open the form it will create a new record even if someone opens it by mistake.
Then you end up with a ton of blank records (not good) DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Hi Kerry!

Set AllowEdits to no. Of course this will keep the user from editing any records using this form. If you want to use the same form to edit and add information then you can use a menu form and open the form with different permissions depending on what the user wants to do.

hth Jeff Bridgham
bridgham@purdue.edu
 
Hi Again!

My mistake, misread what you wanted. If you want to open a form with out the user seeing the existing records then you need to open it using the following code:

DoCmd.OpenForm "FormName", , , , acFormAdd

hth
Jeff Bridgham
bridgham@purdue.edu
 
Thanks fellas. If the easiest thing to do is create an "Add New Record" command button, I'll just do that.

On a related note, when I click on the Add cmd button and go to the blank form, can I do a setfocus on the first field of the form?

As it stands now, the cursor isn't blinking anywhere when the new (blank) form opens. I tried adding a line of code in the "On Click" event procedure that says "Me!.FieldName.SetFocus" but I keep receiving the following error message: "Object doesn't support this property or method."

How come I can't set the focus to the first field of the blank form?

Kerry
 
Don't know why setting the focus wouldn't work in the On Click event of the button, but you could also try it in the On Current event of the form. (The cursor is still on the button after you click it.)
 
If you don't want to use this form to view other records, why not set the form property 'Data entry' to 'Yes' which will ensure it opens up blank. You can set the focus on any control you wish.

If you use this form to view other records, you will need to change the property to 'Data entry' 'Yes' at the time you open the form (whatever method you use).
 
Click "View", choose "Tab order", and arrange the fields in the order you want the focus to follow while entering data. Gus Brunston
An old PICKer
padregus@home.com
 
To open the form on a blank form, enter the following for the On Open event procedure:

DoCmd.GoToRecord , , acNewRec

When you open the form, you will got straight to new record entry.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top