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

Default value

Status
Not open for further replies.

zapzip

Technical User
Jun 19, 2007
46
0
0
US
Hi-

I have a table (L_RR) that I would like a field (called Abbrev) default value set to the right 3 characters of another field called PN.

I have tried using expression builder but get errors. Example: Left ([PN], 3)
Example: Left (tables!L_RR!PN,3)

Can this be done in table?

thanks for any ideas
 
You state "set to the right 3" then you show Left([PN], 3).
Which one?
However, since what you want is derived from a piece of data that's called a calculated field. You do not store calculated fields in a table. No need to. Using the left/right functions in a query, form, report, you will get the desired data.
see:
Fundamentals of Relational Database Design
 
Thanks for your response. Right([PN],3) is what I wanted.

What I am trying to achieve is to set the Default value from a calculated field but to allow overrides.

 
Easiest way is to make a form based on your table. Then in design view, select the form (upper left square). Bring up the property sheet, click the Event tab. Click in the box next to OnCurrent. Click the button with the three dots (build button). Select Code builder. Type in
Me![abbrev].Value = Right([PN], 3)

Now as you advance through the records, abbrev will be created.

After you fill it in for the old data, place it on the AfterUpdate event of PN. A user will enter a PN and Abbrev will be created automatically.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top