Add one to counter query

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

What query will ad one to a numeric field in a table? Will it work even if
field is initially null?

Thanks

Regards
 
Hi

What query will ad one to a numeric field in a table? Will it work even if
field is initially null?

Thanks

Regards

Sounds like you're expecting Access's AutoNumbers to act like a
sequence in Oracle where you can do something like

Counter = SequenceName.NextVal

There is no analogous table-level function in Access. You could use
DMAX([NumericField], [TableName])+1

but you would have to do it in a form...

HTH,

Pieter
 
well, you wouldn't *have* to do it in a form, Pieter; your expression could
be used in an Update query - or in an Append query, depending on what was
needed.

hth


Hi

What query will ad one to a numeric field in a table? Will it work even if
field is initially null?

Thanks

Regards

Sounds like you're expecting Access's AutoNumbers to act like a
sequence in Oracle where you can do something like

Counter = SequenceName.NextVal

There is no analogous table-level function in Access. You could use
DMAX([NumericField], [TableName])+1

but you would have to do it in a form...

HTH,

Pieter
 
Hi

What query will ad one to a numeric field in a table? Will it work even if
field is initially null?

You can't do it in a table - tables don't have computations or events. You can
do an Update query updating a field to

NZ([fieldname]) + 1

to convert null to zero and then increment.

What's the context? When do you want this to happen, and to what?

John W. Vinson [MVP]
 
well, you wouldn't *have* to do it in a form, Pieter; your expression could
be used in an Update query - or in an Append query, depending on what was
needed.

hth


Sounds like you're expecting Access's AutoNumbers to act like a
sequence in Oracle where you can do something like
Counter = SequenceName.NextVal
There is no analogous table-level function in Access. You could use
DMAX([NumericField], [TableName])+1
but you would have to do it in a form...

Pieter

True... I was just assuming (no doubt wrongly) that the OP was going
to use something like that in an insert... (like a query???)...
 
Back
Top