Advancing to 1st Field on next record ??

G

Guest

I'm not sure what I'm missing here; this should be simple...

I have a form that has has a "add new record" command button as the last
stop in its tab series. Theoretically I wanted the user to press that button,
save the current record and move onto the first field of the next (blank)
record.

What happens is when the button is pressed it moves onto the next record but
the button itself remains the active control; so if the user keeps hitting
the return key the form just saves a bunch of blank records rather than
jumping to the first field.

(I already have the "cycle" control set to "all records" so I don't
understand.)

What I'd like is:
-a way to hit the return button on the "add new record button" and jump to
the first field of the next record, and
-some kind of validation that will not allow the form to save a blank record.

Thanks for the help!
~David
 
G

Guest

Set the focus to the control of interest:

Me![YourDesiredControl].SetFocus

To avoid saving a blank record, either set a field as Required at the table
or form level, or use the BeforeUpdate event procedure of the form:

If IsNull(Me![YourField]) Then
Cancel = True
MsgBox "Please enter a value in this field."
Me![YourField].SetFocus
End If

Sprinks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top