简体   繁体   中英

How to autofill table column in MS Access?

I am trying to develop a simple database that stores taking information for a taxi daily figure etc. and there are some calculations that I would like to have auto-filled from basic information supplied by the driver, such as:

  • gross takings given a start and end value from a metering device km's
  • driven given an odometer reading driver owner split given the days takings

The problem I have is I would like to store all these values in a single attribute to make retrieval and entry into another third party system easier. Currently this is paper based and I am trying to digitize this process

The operations are simple mathematical expressions such as addition subtraction and percentage split (multiplication or division)

I've tried various sql commands like

INSERT INTO table (fieldname)
   select 
      table.feildname1, table.feildname2, [feildname2]-[fieldname1]
   from 
      table

I will be using a input form for data entry that will display the basic data input and a drivers share of takings/expenses based upon these calculations

And I'm drawing a blank I'm using ms access 2007

You can do:

INSERT INTO table (fieldname)
SELECT CStr(table.feildname1) & CStr(table.feildname2) & CStr([feildname2]-[fieldname1])
FROM table;

But as @Tarik said, it is not recommended to store all fields in one column, unless it is some temp table or just for view.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM