Many thanks for this - it works great ! Thanks for the url too.
Ian
"Jim Allensworth" <jimNOT@datacentricsolutions.com> wrote in message
news:4270003d.1035266578@news.west.earthlink.net.. .[color=blue]
> Ian, try using the controls's Default value.
>
> Use the form's before update event. Like...
>
> Private Sub Form_BeforeUpdate(Cancel As Integer)
> Me.txtRecNum.DefaultValue = Me.txtRecNum + 1
> End Sub
>
> Don't worry about the dot instead of the bang. The dot works fine.
> But, I would use a naming convention for the user created controls on
> the form. See...
>
http://www.mvps.org/access/general/gen0012.htm
>
> - Jim
>
> On Wed, 27 Apr 2005 17:20:50 GMT, "ISmith" <nobody@nowhere.com> wrote:
>[color=green]
>>Hi,
>>
>>Thanks for thie tip. I tried your suggestion:
>>
>>Private Sub Form_AfterUpdate()
>> Me!TNum = Me!TNum + 1
>>End Sub
>>
>>(where TNum is the name of the Text field with the value in!), but instead
>>of going to a new record when I click the standard next button the field
>>increments only - I don't get a blank record + increment field. Also when
>>I
>>close the form the field increments once again and I get "you can't save
>>this record at this time. MS access may have encountered an error while
>>trying to save a record. if you close this object now the data changes you
>>have made will be lost. do you want to close anyway". If I force the
>>close
>>then the record is stored but the incremented field is one less than the
>>form was displaying when I tried to close it.
>>
>>Ian
>>
>>
>><dedejavu@hotmail.com> wrote in message
>>news:1114620445.392052.120110@f14g2000cwb.google groups.com...[color=darkred]
>>> Ian
>>> If you posted your code it would help - but I'll give it a guess as to
>>> what you are doing.
>>> It sounds like you are trying to increment a field every time the
>>> record is saved.
>>> Your solution may be as simple as me.field =me.field +1
>>> The form has an AfterUpdate event you might use.
>>> A word of advice, if you are referencing the dataset and not a control,
>>> you should reference it using a ! e.g. me!field =me!field +1. The Dot
>>> will fail in some situations.
>>> HTH
>>> Pachydermitis
>>>[/color]
>>
>>[/color]
>[/color]