RE: manually incrementing number code does not work in a2003
- From: "wellssh" <wellssh@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 21 Dec 2005 13:10:04 -0800
I just noticed one other difference, at work -- SP1 has been installed, maybe
a flaw in the service pack ?
"Ofer" wrote:
> Mybe, and sorry if it will sound like a silly question, but does the dmax is
> looking in a table called Table1, but are there any records in this table?
>
> --
> Please respond to the group if your question been answered or not, so other
> can refer to it.
> Thank you and Good luck
>
>
>
> "wellssh" wrote:
>
> > I tried the added code you suggested, and the value returned remains as
> > ES-00001 and will not increment by 1
> >
> >
> >
> > "Ofer" wrote:
> >
> > > Does it return any value?
> > > If it doesn't, try this incase the field is empty and not Null
> > >
> > > Private Sub Form_BeforeUpdate(Cancel As Integer)
> > > If IsNull(Me!Estimate_Number) Or Trim(Me!Estimate_Number)="" Then
> > > Me!Estimate_Number = "ES-" & (Format(CLng(Right(Nz(DMax("Estimate_Number",
> > > "Table1"), 0), 5) + 1), "00000"))
> > > End If
> > >
> > > End Sub
> > >
> > >
> > > --
> > > Please respond to the group if your question been answered or not, so other
> > > can refer to it.
> > > Thank you and Good luck
> > >
> > >
> > >
> > > "wellssh" wrote:
> > >
> > > > Hello,
> > > >
> > > > I am trying to write the code to increment a number with 2 alpha characters
> > > > and a dash in front as follows ES-00001. The number should increment by one
> > > > each time the user inputs a new record using the form.
> > > >
> > > > I am using the following code, and it works great when tested on a db
> > > > created in A2000. However will not increment at all when using in a db
> > > > created in A2003 SP1
> > > >
> > > > Private Sub Form_BeforeUpdate(Cancel As Integer)
> > > > If IsNull(Me!Estimate_Number) Then
> > > > Me!Estimate_Number = "ES-" & (Format(CLng(Right(Nz(DMax("Estimate_Number",
> > > > "Table1"), 0), 5) + 1), "00000"))
> > > > End If
> > > >
> > > > End Sub
> > > >
> > > > Is there additional code needed to make it work for A2003?
> > > >
> > > > Thank you in advance
> > > >
> > > > Sherman Wells
> > > >
.
- Follow-Ups:
- References:
- Prev by Date: Re: searching the list box
- Next by Date: Re: Set The Visibility of A Control Based Off A Combo Box Option
- Previous by thread: RE: manually incrementing number code does not work in a2003
- Next by thread: RE: manually incrementing number code does not work in a2003
- Index(es):
Relevant Pages
|