Copying only one field's data on continuous form

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

Hi All,

I have a form with a sub-form in which the sub-form's view is continuous.
On the sub-form are fields A, B, C, etc... Here's what I would like to
accomplish:

1) User fills in required data in the form and tabs to the sub-form's first
control, control A, which is a combo box
2) User fills in required information (including control A) and tabs out of
the last field in the sub-form, starting a new record in the sub-form
3) Control A automatically gets the value entered in the previous record on
the sub-form. This value can then be changed or the user can tab through it
to the balance of the fields

Essentially, I want to pass the value of control A to each subsequent
record, allowing the user the ability to change it when needed.

I don't want to use a command button to duplicate the record since there
will be many records on the sub-form and I'm trying to cut down on key
strokes. Also, I know that I the direction I should be looking is recordset
clone, but don't know how & when to use it.

Any help is greatly appreciated.

Thanks & Ciao,

Tony
 
Hi All,

I have a form with a sub-form in which the sub-form's view is continuous.
On the sub-form are fields A, B, C, etc... Here's what I would like to
accomplish:

1) User fills in required data in the form and tabs to the sub-form's first
control, control A, which is a combo box
2) User fills in required information (including control A) and tabs out of
the last field in the sub-form, starting a new record in the sub-form
3) Control A automatically gets the value entered in the previous record on
the sub-form. This value can then be changed or the user can tab through it
to the balance of the fields

Essentially, I want to pass the value of control A to each subsequent
record, allowing the user the ability to change it when needed.

I don't want to use a command button to duplicate the record since there
will be many records on the sub-form and I'm trying to cut down on key
strokes. Also, I know that I the direction I should be looking is recordset
clone, but don't know how & when to use it.

Any help is greatly appreciated.
Just set the combo's default value in the After Update even...

Private Sub cboA_BeforeUpdate(Cancel As Integer)
Me.cboA.DefaultValue = Me.cboA
End Sub

The next row wil have the previous choice as the default value.


- Jim
 
Hey Jim,

This works, but the value displayed is incorrect. For example, if the user
selects '26-1387-1-03' the value displayed is '-1365' until the next record
is completed.

Any ideas? & thanks for the help.

Tony
 
OK, getting closer to what's wrong...

If the value in the control is '26-1387-1-03', it looks like it is being
treated as an equation with the result being '-1365'. All the db fields are
set to text, so I'll have to do some hunting to find out what I've done
wrong.

Thanks again for the help. In this case, a little code went a long way.

Ciao,

Tony
 
Ah, that's interesting.

Tony, try this: wrap the control in double quotes - Chr(34). That
should coerce it to a text value.

Private Sub cboA_BeforeUpdate(Cancel As Integer)
Me.cboA.DefaultValue = Chr(34) & Me.cboA & Chr(34)
End Sub

- Jim
 
Jim,

Thanks for the suggestion. I thought about that but haven't done so yet.
If anything new comes up, I'll post here again.

Thanks again,

Tony
 
Back
Top