Incremental Rise in a number field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I have a table called TaskStep with the following fields:

TaskStepCode = Autonumber
TaskCode = Number - Linkeed to tblTask
TaskStepTypeCode = Number - Linked to tblTaskStepType
OrderID = Number
TaskStepText = Memo

What I would like to do is incrementally raise the OrderID field by 1 based
on explicit data for the rest of the row i.e.

TaskCode = 1
TaskStepTypeCode = 1
OrderId = 1
TaskStepText = XXXXXXXXSSSSDDDDDFFGG

Next TaskStep OrderId = 2 and so on for TaskCode =1 and TaskStepTypeCode =1
and when either of these 2 change then the OrderID starts at 1 again.

MTIA
 
When you are gathering your data, for the row, add something like this:

IIF(IsNull(DMax("OrderID", "[tblTableName]", "TaskCode =
[Forms]![frmFormName]![txtTaskCode] and TaskStepTypeCode =
[Forms]![frmFormName]![txtTaskStepTypeCode]")), 1, DMax("OrderID",
"[tblTableName]", "TaskCode = [Forms]![frmFormName]![txtTaskCode] and
TaskStepTypeCode = [Forms]![frmFormName]![txtTaskStepTypeCode]") +1)

HTH

Sharkbyte
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top