Tabbing in a subform deletes the record above

  • Thread starter Thread starter Dawn Anastasi
  • Start date Start date
D

Dawn Anastasi

I have a main form with a field called TICKETID and a subform with the
same field name (among others). The user enters the TICKETID in the
main form along with other data, then saves the record. Later, goes
back in and adds lines to the subform that is displayed in datasheet
view. The TICKETID field is the link between the main form and
subform.

Sometimes, but not all the time, the user entering tickets will go to
the subform, add a line item, then tabbing to the next record in the
subform, will notice that the first line disappears (but is still
displayed as a blank record). Now we are getting blank records in the
database.

Has anyone seen this? I observed this myself and am not sure why this
is occurring.

Thank you in advance.

Dawn
 
To prevent a completely blank record from being added, open the subform's
table in design view, and set the Required propery (lower pane) of one of
the fields to Yes. You probably want to set the TicketID's Required property
to Yes in this table also.
 
I tried a few suggestions:
1) Creating a new database and importing all items from my original
database.
2) Running a compact & repair on both the main database and the
back-end database.
3) Making "TICKETID" a field that cannot be zero-length in both
tables.

However, the situation is still occurring when a user goes into Access
and creates a ticket (saved in table TICKET), they enter the subform
and enter lines in table PARTS, sometimes when they tab to the second
record, the first record appears to be blanking out. What happens is
that there is a record saved in the PARTS table with the information
however the TICKETID field is blank.

Any other suggestions?

Dawn
 
If your users are saving a reocrd in the subform where all the fields are
just blank, then open the subform's table in design view again, and set the
Required property to Yes for one of the other fields as well.
 
Not all of the fields are blank as I originally thought. Actually,
all of the info is filled in except the TICKETID is left blank. I
would assume that the record above then looks blank because if the
main form and subform are tied by TICKETID, it doesn't know how to
display a record without the TICKETID field filled in, in the subform
table.

Dawn
 
Go back to the first reply to your original question, and set the TicketID
to required in the related table.
 
Thank you for your advice so far Allen.

I have set the TICKETID field to Required in the table. However, now
the user is getting the message after they tab out of the record (to
go to the next line) that the field is required and cannot be null.
So apparantly the database is deciding to delete the contents in that
field.

Why would it do that if the user is just tabbing off of that field?

Dawn
 
Dawn, I'm not sure what else might be going on in your database to clear
this text box, or possibly it never did have an entry to start with.
Hopefully you can see if it did, and track the point at which this occurs.
 
Well, I unhid that field from being displayed for troubleshooting
purposes. The field name on the form is txtTICKETID and the data it
contains is captured in a table field name called TICKETID. I've
asked the user in question to watch to make sure that this field
contains the ticket number. So far, it has and she gets no error
about requiring a value in that field (obviously).

She has seen one instance where she added the first line, then tabbed
to the second line and the first line "disappeared", then she got the
error message about the TICKETID field being null which it can't be.
It seems like sometimes when she starts a record, it's not populating
the TICKETID field with the related data from the main form, but only
sometimes.

This can't be random, so there must be a SPECIFIC cause, but it's
driving us nuts trying to figure the "why" out.

Dawn
 
Ah, the name of the text box is not the same as the name of the field it is
bound to.

I assume from your original thread that the TicketID field is named in the
LinkChildFields property of the subform control. If so, the value may be
supplied automatically from the TicketID in the main form directly to the
field in the subform's recordset and not to the text box.

Try renaming the text box so it has the same name as the control.
Or you could try naming the text box (txtTicketID) in LinkChildFields.
 
Back
Top