Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / June 2007

Tip: Looking for answers? Try searching our database.

proper placing of an event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JohnE - 11 Jun 2007 20:26 GMT
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.
>>> John
Douglas J. Steele - 11 Jun 2007 20:32 GMT
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)

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I have a form that has multiple fields on it.  There is one field that is
>for
[quoted text clipped - 7 lines]
> feedback.
>>>> John
JohnE - 11 Jun 2007 21:31 GMT
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?

>>> John

> To show it for existing data, you need the code in the form's Current event.
>
[quoted text clipped - 14 lines]
> > feedback.
> >>>> John
Douglas J. Steele - 11 Jun 2007 21:59 GMT
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

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> My apologies, I re-read this an did not include the conc line.  Here it
> is.
[quoted text clipped - 31 lines]
>> > feedback.
>> >>>> John
JohnE - 11 Jun 2007 22:13 GMT
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?
>>> John

> 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?
[quoted text clipped - 44 lines]
> >> > feedback.
> >> >>>> John
JohnE - 11 Jun 2007 22:21 GMT
I got it to work.  Thanks for the help.

> 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?
[quoted text clipped - 44 lines]
> >> > feedback.
> >> >>>> John
mtn244 - 11 Jun 2007 20:44 GMT
John,
You can put the concatenation formula in the Control Source of your concat
text box:

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

Miki

> 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
[quoted text clipped - 4 lines]
> feedback.
> >>> John
JohnE - 11 Jun 2007 21:43 GMT
I tried this method but I get an error message about assigning value to the
object.  
Thanks.

> John,
> You can put the concatenation formula in the Control Source of your concat
[quoted text clipped - 12 lines]
> > feedback.
> > >>> John
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.