proper placing of an event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that has multiple fields on it. There is one field that is for
the a concatenation of 3 of the other fields. The concat field is not bound
while the other 3 are. I have the concat all worked out and placed in the
after_update event of the last of the 3 fields. Mainly, my question is where
is the best place to put the event so the concat field shows the 3 field
concatenation everytime the form opens, requeries, etc? Thanks for the
feedback.
 
To show it for existing data, you need the code in the form's Current event.

Incidentally, you shouldn't really assume that everyone's going to fill in
the fields sequentially. My advice would be to create a function that does
the concatenation, and call that function in the AfterUpdate event of all
three of the text boxes (plus in the form's Current event)
 
John,
You can put the concatenation formula in the Control Source of your concat
text box:

=[field1] & [field2] & [field3]

Miki
 
My apologies, I re-read this an did not include the conc line. Here it is.
Me.txtProjectName = cboProjectClient.Column(1) & "-" &
Me.txtTicketNumber & "-" & Me.txtProjectType

I placed this in the OnCurrent event of the form but only the - - shows up.
What did I do wrong?
 
I tried this method but I get an error message about assigning value to the
object.
Thanks.


mtn244 said:
John,
You can put the concatenation formula in the Control Source of your concat
text box:

=[field1] & [field2] & [field3]

Miki

JohnE said:
I have a form that has multiple fields on it. There is one field that is for
the a concatenation of 3 of the other fields. The concat field is not bound
while the other 3 are. I have the concat all worked out and placed in the
after_update event of the last of the 3 fields. Mainly, my question is where
is the best place to put the event so the concat field shows the 3 field
concatenation everytime the form opens, requeries, etc? Thanks for the
feedback.
 
Is this a new record or an existing one? In other words, when you switch to
the new record, does it have values for the 3 controls or not?

If it doesn't, try check whether it's a new record or not:

Private Sub Form_Current()

If Me.NewRecord = False Then
' call your concatenation routine
End If

End Sub
 
This would be an existing record. When adding a new record it should also be
showing it, which is the after_update events of the 3 fields. I just made
the change as you mentioned, still nothing. These fields are on a tab
control (no subform involved) which shouldn't make a difference as the tab
control is no different then the form.
Any further advice?
 
I got it to work. Thanks for the help.


Douglas J. Steele said:
Is this a new record or an existing one? In other words, when you switch to
the new record, does it have values for the 3 controls or not?

If it doesn't, try check whether it's a new record or not:

Private Sub Form_Current()

If Me.NewRecord = False Then
' call your concatenation routine
End If

End Sub
 
Back
Top