Blank record in subform

McRoberts

Registered User.
Local time
Today, 18:04
Joined
Feb 7, 2006
Messages
28
I have a main form with many subforms. The sub forms are all continuous but one and I want the editors to be able to put in more then one record if needed.
My problem is I have my tabs set up so that when the box is empty it will tab to the next subform. When I do this, a extra blank record is automatically saved in the subform above. How do I get rid of the blank record?
Thank you in advance for any advice shared.
 
You must be dirtying the record some how. Access will not save a record on its own unless the record is dirty.
 
What do you mean by dirtying the record?
On the first field of each subform I have an "On Exit" event
If IsNull(Me.EventCategory) Then
Me.Parent.[frmeventCsubform].SetFocus
End If
I have this so that when I tab through a subform when I am done entering it will tab to the next subform.
The extra record is blank.
 
A record is considered "Dirty" when a field has been changed and not saved to disk. Somewhere your code is changing a field and moving from tab to tab is saving the record. You can catch it in the BeforeUpdate event of the SubForm if you line and issue a Me.Undo to clear the change but that is really not the proper way to handle it. Stop changing the field and the "blank" record will go away.
 
Would it be because the subform is linked to the EventID in the main form?
 
No. Somewhere you are changing a field in the RecordSource of the subform. Access will in fact fill in the EventID field for you in the SubForm if it is the LinkChildField, but *only* if you change some other field. It will not dirty the record on its own.
 
Last edited:
I have created a dummy database that is similar to the one that I am having problems with.
I have attached the database so that you can see what I mean. You are right that it is dirtying the record but I don't know why. Can you take a look at it?
 

Attachments

There are some other issues with which you will have to deal but removing the code from the Current event solved the extra record problem. I changed the RowSource of the EventType Combo so the code in the Current event is not necessary.
 

Attachments

Now the cascading combo box doesn't seem to work. When I choose the Event Category then click on Event Type it says Enter Parameter Value.
Thanks for your help.
 
Is that happening on the db I posted? Mine works just fine.
 
Does it compile? Does it have any MISSING references?

Edit: It will only work when it is a SubForm!
 
When I am in the subform I do not get that message but the cascading combo box is not working properly. It doesn't bring up the appropriate event types for the selected Event Category.
 
In the SubForm change the AfterUpdate event of the EventCategory cbo to:
Code:
Private Sub EventCategory_AfterUpdate()
   Me.EventType.Requery
End Sub
 
That worked. Thank you so much for your help. It is a relief to finally move on. What do you mean by "There are some other issues with which you will have to deal". I am new to Access and thought that I was doing okay but would appreciate whatever advice you could give me.
 
I honestly don't remember. There are just things I noticed as I was looking at your forms and code. Just deal with one problem at a time. As you encounter issues you can not get around just post back to the forum and I'm sure someone will assist.
 

Users who are viewing this thread

Back
Top Bottom