One new entry at a time on a form

  • Thread starter Thread starter KevinB
  • Start date Start date
K

KevinB

I have a form 'AddRecord' opened using

DoCmd.OpenForm "AddRecordForm", , , "[VesselID]=Forms!
[VesselSubform].[VesselID] ", acFormAdd

This opens the form required ready for a new record - fine!
Except I now have to make this idiot-proof for my work
colleagues who keep using the mouse wheel (or tab through
the form) creating 2 or more partially completed records
for the same piece of info.

I want to change the form to edit only as soon as the 1st
piece of information on the form has been typed, so that
when the mouse wheel is used, or the user tabs through the
form to the ist field again, a new record cannot be
started without going back to the start menu.

I think i should be setting the forms AllowAdditions to
false, but unsure on what event to use and the code to
accomplish this.

I would be very pleased if someone could advise.

Regards
Kevin
 
I am not sure why you used the "wherecondition" if you specified
"acFormAdd"???

You can try set the Cyle Property of "AddRecordForm" to CurrentRecord to
prevent tabbing to the next new Record.

To prevent mouse-wheel scrolling, you can check the "mousewheelonoff" fron
Stephen Lebans' Web site:

http://www.lebans.com/mousewheelonoff.htm

Microsoft site also has articles on how to prevent mouse-wheel scrolling in
Access Forms:

http://support.microsoft.com/default.aspx?id=278379

HTH
Van T. Dinh
MVP (Access)
 
Answers inline.
I have a form 'AddRecord' opened using

DoCmd.OpenForm "AddRecordForm", , , "[VesselID]=Forms!
[VesselSubform].[VesselID] ", acFormAdd

Change that to:

DoCmd.OpenForm "AddRecordForm", , , , acFormAdd

Since you have opened the form in "Data Entry" mode, including the WhereCriteria
is pointless (as Van has already pointed out).
This opens the form required ready for a new record - fine!
Except I now have to make this idiot-proof for my work
colleagues who keep using the mouse wheel (or tab through
the form) creating 2 or more partially completed records
for the same piece of info.

It sounds as though you are using code in the form's "On Current" event
procedure to add a new record. In any case, you could include code in that event
procedure to check the form's "Recordsetclone.RecordCount" property and if a
record exists move back to the first record (skipping any code that would start
a new record, of course):

'*************EXAMPLE START
If Me.RecordsetClone.RecordCount > 0 Then
DoCmd.GoToRecord , Me.Name, acFirst
End If
'*************EXAMPLE END
 
Back
Top