G
Guest
I have a form that is just using the default record navigation buttons. My
problem is that when I get to the last record and click move next it creates
a new record. I know that this is how it is supposed to work, but my problem
is that it does not then disable the next or new record buttons and
subsequent presses of either button save the blank record that was previously
created even though I had not entered any values on the form, for that
matter, I had not even moved the mouse away from the next record button. I
get the same issue if I use the delete record button from the access toolbar.
It deletes the record, but creates a new one right after the deletion. If I
click delete again, it deltes the new record it just made on the last delete,
but it then make another new record.
The fields that get populated on the record are an autonumber key, a field
that is to default to today's date, 2 numeric fields that default to 0 and a
yes/no field that defaults to no.
All of these defaults are on the underlying table, not on the form. So they
should not be the issue.
If I add the following code it will just make one new record and save it
before it diables making new records, but that is still one too many as I
know the users here will always just keep clicking next until they are not
able to do so.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.cboNCRType = "" Or IsNull(Me.cboNCRType) Then
DoCmd.RunCommand acCmdUndo
End If
End Sub
cboNCRType is the first field that people need to enter to get the rest of
the form to function, so it is a good one to use to make sure that the record
either should or should not be saved.
Any help would be greatly appreciated!!!!!
problem is that when I get to the last record and click move next it creates
a new record. I know that this is how it is supposed to work, but my problem
is that it does not then disable the next or new record buttons and
subsequent presses of either button save the blank record that was previously
created even though I had not entered any values on the form, for that
matter, I had not even moved the mouse away from the next record button. I
get the same issue if I use the delete record button from the access toolbar.
It deletes the record, but creates a new one right after the deletion. If I
click delete again, it deltes the new record it just made on the last delete,
but it then make another new record.
The fields that get populated on the record are an autonumber key, a field
that is to default to today's date, 2 numeric fields that default to 0 and a
yes/no field that defaults to no.
All of these defaults are on the underlying table, not on the form. So they
should not be the issue.
If I add the following code it will just make one new record and save it
before it diables making new records, but that is still one too many as I
know the users here will always just keep clicking next until they are not
able to do so.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.cboNCRType = "" Or IsNull(Me.cboNCRType) Then
DoCmd.RunCommand acCmdUndo
End If
End Sub
cboNCRType is the first field that people need to enter to get the rest of
the form to function, so it is a good one to use to make sure that the record
either should or should not be saved.
Any help would be greatly appreciated!!!!!