Help coding please

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

Definitions
-----------------
TABLE NAME: 'Table A'

Table A, has six records in it.
Each record consists of two fields. ID, and VALUE.
ID happens to be the primary key for table.

ID value for record one : '1'
ID value for record two : '2'
ID value for record three : '3'
ID value for record four : '4'
ID value for record five : '5'
ID value for record six : '6'

The table operates as a tally system. I need to do the following.

First Requirment.
-----------------
increment the value field for a record by 1. As an onclick event, how
would I do this. Assuming the table is called 'Table A' and I want to
increment the VALUE field of record '3' by '1'

Second Requirement.
-------------------
I need to determine the ID of the record with the lowest entry for its
VALUE field. And I need to store this ID in a varable called ID$ for
use in my code.

If someone could show me how to do the above I would be well on my way
to solving something which i've been working on for 2 weeks now.

Thanks very much,

Gary.
 
You can set the DataType propery of the ID field to AutoNumber and then the
New Values property to Increment which will cause each new record to have
the next value. If you delete records, you will have gaps, however, this is
fine because you don't want to depend on the ID value as a record counter,
it is just a way to identify the row and that is all. If you want a record
to have a specific value, you should create a separate field to contain
those values.
To get the min value you can do something like:

SELECT Min(tblActuals.TaskID) AS MinOfTaskID
FROM tblActuals
Create a query, click the Sum button, change the Total row from Group to Min
for the field that you want to find the minimum value.
 
Back
Top