Results 1 to 8 of 8
  1. #1
    don911no is offline Novice
    Windows XP Access 2002
    Join Date
    Jun 2016
    Location
    Los Angeles, CA
    Posts
    10

    How to create data in one field based on another field?


    How do I automatically create data in one field based on another field? For example, in field 1, I have entered a value in kilos. I now want field 2 to automatically show the value of field 1 but in pounds.

    I'm using Access 2002 on Windows XP.

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Where are you wanting to do this? A table? A form?

    Please provide more details.

  3. #3
    don911no is offline Novice
    Windows XP Access 2002
    Join Date
    Jun 2016
    Location
    Los Angeles, CA
    Posts
    10
    Hi John_G, thanks for your quick reply!

    I'm using a table. I'm editing in Design View and viewing and working with the data in Datasheet View.

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    For a table, I suggest that you keep only one weight value in the table; when you need the other value(s), use queries. In A2002, you can't automatically populate one table field based on values in other fields.

    A2010 (maybe A2007, too) does have calculated fields, but IMO they should be avoided - as I said, that's what queries are for.

    You really should be using forms for data entry, instead of entering data directly into tables. Forms provide a lot more features in the way of data checking and validation than tables do.

  5. #5
    don911no is offline Novice
    Windows XP Access 2002
    Join Date
    Jun 2016
    Location
    Los Angeles, CA
    Posts
    10
    OK. So how would I go about if I wanted to use a query to populate values in field 2 using the value in field 1 x 2.2 (for kilo to pounds conversion)? I have 7000 records in my table. And please answer like I'm 5 years old. :-) My knowledge of Access, programming and SQL etc. is very limited.

  6. #6
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    To just display the conversions without actually storing the values in a table, use a Select query. Include all the fields you need from your table, plus a calculated query field -

    Pounds: [Kilos] * 2.2 , where Pounds is the column header when the query is run.

    If you really do want to keep the Pounds value in the table, and you have a table field set aside for it, then you use an Update query. In query design view, add the table to the design. You only need the two fields, assume they are Kilos and Pounds. Change the Query type to Update, and in the "Update To" box in the Pounds column, put [Kilos] * 2.2 .

    When you run the query, and the Pounds fields will be populated.

  7. #7
    don911no is offline Novice
    Windows XP Access 2002
    Join Date
    Jun 2016
    Location
    Los Angeles, CA
    Posts
    10
    Hi John, I successfully followed your instructions to add a new field with Pounds to my table with an update query. Thank you very much!

    Also, perhaps you can help me with another issue that has puzzled me for a long time. I want a field in my Table (table view) to display a numeric value with one decimal, regardless of how many decimals is put in. However, I can't get it to work. When the field is set to 'Number' and filed size to 'Single' with 1 decimal, the value is still shown with as many decimals as written in, i.e. if I write 155.565, then that's what is shown. I want it to show 155.6 when I type in 155.565. And if I choose 'Integer' with 1 decimal, then 155.565 becomes 156. Any hep would be greatly appreciated.

  8. #8
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    The internal storage format of a number is always the same for any specific data type, regardless of how many decimal places you want to show. You use the Format property of a field to specify how you want to to be displayed.

    However, as a general rule, you don't set formats directly on table fields, because you shouldn't enter or display data by opening tables directly. Use forms to enter or update data, and queries or reports to display it. Queries, reports and forms all have format properties on controls and fields.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 01-09-2015, 05:48 PM
  2. Replies: 4
    Last Post: 10-16-2014, 08:44 AM
  3. Replies: 1
    Last Post: 08-10-2014, 04:06 PM
  4. Replies: 10
    Last Post: 07-19-2013, 02:05 PM
  5. Replies: 2
    Last Post: 03-07-2013, 04:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums