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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto filling of data on subform 1

Status
Not open for further replies.

twobit94

Technical User
Nov 2, 2002
10
US
I have a form to enter contact information into my main form of a contact management database. As the user enters in a first name, last name, spouse and titles I need it to automatically fill this info into another table in the following formats:

Field Result
SaveAs last name, first name (ex. Doe, John)
Greeting first name & spouse name (ex. John & Jane)
Address title & spouse title first name last name (ex. Dr. & Mrs. John Doe)

This is to print automated letters and envelopes.

Even though I want these automatically entered I would also like to be able to change them (ie. change the greeting name from Johnathan to John)

If anyone can help I would greatly appreciate it.



 
Just concatanate the fields together and store them. Simply open up the table hidden (or even better put bound text boxes on the form, hidden) and use something like:

[SaveAs] = Me![LastName] & ", " & Me![FirstName]

This will provide you the data you want.

BUT, and I stress the BUT part, this is not the way you should develop your database....You should use this concatanation on you REPORTS. To have a normalized database, which is every record being unique with no duplication of data, you should only stare the names as you enter them. Then in your reports, use the above concatanation string. It will prodcue the same effect, keep you database smaller and therefore more efficient, and less work for you coding.

Just my $.02 (+$1.00 for the suggestions)

If you need anymore info or help, please let me know.
Programming isn't a profession of choice.
It's a profession of calling...
"Hey Programmer, your application broke again!" [spin]

Robert L. Johnson III, A+, Network+, MCP
robert.l.johnson.iii@citi.com
 
i know it's pretty late to join this one - but i think you may be able to help me.
following on from your stressed BUT . i'm trying to concat two fields on a form. the fields in the table are firstName and Surname, i can't seem to get them into one textbox on the form. i've tried
Code:
 =[surname] & [firstName]
and
Code:
 =[surname] AND [firstName]
and
Code:
 [surname] & [firstName]
and
Code:
 [surname] AND [firstName]

all to no avail - and now i'm lost - can you help?
all i get is either #name? or #error or -1
:(

faxof
 
Hi faxof

Don't know if this too simplistic an answer, but...

... if your unbound text box has the same name as one of the fields in your table, e.g. the unbound text box is called 'Firstname', but its control source is '=[Firstname] & " " & [Surname]', you will get the '#name?' error.

To avoid this, change the name of the unbound text box to a name which isn't the same as any of the fields in your table, e.g. 'Fullname'.

Colin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top