Continuous form First record

  • Thread starter Thread starter Design by Sue
  • Start date Start date
D

Design by Sue

On a continuous subform with only one field (suffix) I need to automatically
enter 0 when the field gets focus and then set the focus to the next record
in the subform, leaving the 2nd record blank and ready for the user to enter
a number. I have tried in the field's OnGotFocus event the following code.

If IsNull(Forms!InPutFrm!SuffixSubFrm!Suffix) Then
Forms!InPutFrm!SuffixSubFrm!Suffix = 0
EndIf

I had the code to go the next record after that but as you can quickly see,
that puts a 0 in the second record and I get an error message that it created
a duplicate.

So I now need help to make this work only on the first record.

All assistance greatly appreciated!

Sue
 
On a continuous subform with only one field (suffix) I need to automatically
enter 0 when the field gets focus and then set the focus to the next record
in the subform, leaving the 2nd record blank and ready for the user to enter
a number. I have tried in the field's OnGotFocus event the following code.

If IsNull(Forms!InPutFrm!SuffixSubFrm!Suffix) Then
Forms!InPutFrm!SuffixSubFrm!Suffix = 0
EndIf

I had the code to go the next record after that but as you can quickly see,
that puts a 0 in the second record and I get an error message that it created
a duplicate.

So I now need help to make this work only on the first record.

All assistance greatly appreciated!

Sue

Sue,

I would use a SQL statement to insert the record when the parent form
is loaded and then refresh the continuous form. This allows you do all
sorts of validation and error checking.

But are you sure that a Textbox/listbox combination wouldn't be a
better solution here? Ie. enter the field in a textbox which then
feeds the listbox? I only ask because this seems a little error prone.
Can you provide some context for the usage because I'm really curious
now.

Anyway, that was my 2 cents, which I've been spending rapidly today...

Regards,
James
 
Thanks for the reply - I will try this when I resume work on the project.
The field is a text box. I'm not sure why I would need a list box also.


thanks
Sue
 
Back
Top