Continuous form First record

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
 
M

Minton M

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
 
D

Design by Sue

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
 

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