Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New field concatenated automatically from 2 other field in form 1

Status
Not open for further replies.

cafulford

MIS
Joined
Oct 14, 2009
Messages
30
Location
US
Hi, I am new in Access and coming along fairly nicely but I am trying to figure out how to take 2 fields in an existing form, named "carrier_name" and "trailer_number" (both text fields), and:

1) concatenate them into a new field called carrier_trailer automatically maybe when you enter the form??
2) The new field, "carrier_trailer" is displayed as reference only and not editable (not sure where this is done)
3) make sure the new field is trimmed so the data is together. For example:
Field "carrier_name" is 50 characters = "Freightway"
Field "trailer_number" is 35 characters = "12345"
New field "carrier_trailer" = "Freightway12345" w/no spaces or anything in between

Also, how could I add a time date stamp to a field so when the form is exited, a time stamp is added?

In another form, this new field will be used as an index to print only those bill of ladings from carrier/trailer # that the user enters.

Thanks in advance
 
(1)
In the Control Source Property for the carrier_trailer textbox place this:

=[carrier_name] & [trailer_number]

Despite the field being set to X number of characters, no trimming of spaces is needed because in Access this is a limit, not an allotment. In other words, Access doesn't by default use Fixed Width Strings.

(2)
In the Form_BeforeUpdate event use this code

Me.TimeStampField = Now()

TimeStampField will, of course, have to be bound to a field in the underlying table.

(3)
You should not store the combined carrier & trailer field, but rather re-concatenate it whenever (as in the 2nd form) it is needed again.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Missinglinq, thank you so much! I really appreciate the response.

Charlie
 
Charlie,
Missinglinq gave you a great answer which deserves a star. You should click the link "Thank Missinglinq for this valueable post"

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top