Avatar of marian68
marian68

asked on 

new record button in a form

I have a form with 3 pages.
I would like to know if it is possible, after I finished entering a new record(so I am on the page 3) when I push on the  button "new record"  to go automatically to the beginning of the 1st page to start entering another record?
Thank you very much,
.NET ProgrammingMicrosoft Access

Avatar of undefined
Last Comment
marian68
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

in the click event of the button, place this codes

docmd.gotorecord,,acnewrec
docmd.gotopage 1
if you are using tabcontrol, use this

me.tabcontrol.pages(0).setfocus
docmd.gotorecord,,acnewrec
Avatar of marian68
marian68

ASKER

I was talking about the default button of Access to create a new record.
Do you recommend me to create a button and to use the above code?
Thank you very much
do you mean the button with >* ?

i think you better create your button for this purpose
Avatar of marian68
marian68

ASKER

Yes the button you mentioned >*,
Ok, I will create my own button for this purpose and I will tell if it works in a couple of minutes.
Thank you very much
Avatar of marian68
marian68

ASKER

I built a command button on the last page of the form.
When I am using the first code the form is ready for a new record but I remain on the same page.
When I am using the 2nd code it shows me the it is something wrong with "tabcontrol" from your code, it is blackened. Do I have modify the "tabcontrol" with something?
Here are the code
Private Sub Command667_Click()
Me.TabControl.Pages(1).SetFocus
DoCmd.GoToRecord , , acNewRec
End Sub
Thank you
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of marian68
marian68

ASKER

It worked by instead of this chunk of code
"tabcontrol.pages(0)"
I put the name of the first page of the form
Thank you
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo