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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Don't want to have blank row showing in form

Status
Not open for further replies.

kaiana

Programmer
Joined
Sep 6, 2002
Messages
85
Location
AU
I have a form that is opened from another form, it auto fills the first field from data in the form, however once it fills that field and sets the focus to the second field it also adds another blank row with the *. I don't want it to add that row unless "Add Training" button is clicked again. I have tried changing the "Allow additions" but it then doesn't allow the new record with the autofill either. Any suggestions would be appreciated.
 
(a) Make sure that the AllowAdditions property of the form is set to False when the form is opened. You can do this from Design View or (to be extra sure - from the forms OnOpen event, by adding the line:

me.AllowAdditions = False

(b) In the "Add Training button", add the following blue line before and after the docmd line which adds the new record:

Me.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec

(c) Then add the following line in the AfterUpdate event, to prevent addition of another record once the first has been saved:

Me.AllowAdditions = False

I'm assuming here that the button is on the same form as the record being added; otherwise you wont be able to use the 'Me' syntax.

Let us know if this does the trick,


Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top