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!

Updates via If statement

Status
Not open for further replies.

circles

Technical User
Feb 12, 2001
26
US
I have a table (tbllightning) that has each state coded as a number. For example Alabama is coded as 1, Alaska as 2,Arizona as 3, and so one. What I am trying to do is use an Iif statement to change the state numeric code to the actual state name so that on the table Alabama will replace the number 1 under the state column etc. I must admit I am not very good with using VB code/SQL statements. Any help is greatly appreciated.
 
Probably the best way, in the long run, would be to create a new table that relates the state number with the state name. You can then reference that table in tbllightning's definition for the state field, on the Lookup tab. Change the control type to List Box, set the table name to your states lookup table, set the Column Count to 2, and set the Columns Widths to 0". When you open the table datasheet, the lookup into the states table should happen automagically.

This method has the advantage that, when you build a form that contains the state number from tbllightning, Access will make it easy for you to set up the same lookup list box or combo box on your form. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top