RE: manually incrementing number code does not work in a2003
- From: "Ofer" <Ofer@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 21 Dec 2005 15:16:02 -0800
Press Ctrl+G , you get to the code section, when the screen is split to two.
On the buttom screen type
?Dmax...
Press enter and see what value returned
And I'm sorry, but I should have said that, I'm using A2003 on WXP.
But that shouldn't make a different
I never got a problem with Dmax, transfering my MDB from Access2.0 to
Access97, and from there to Access2003, and I got alot of Dmax
--
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:
> Ofer, you tried it using A2003 on W2PRO and it worked hmmmm you lucky dog ;-),
> forgive me, but I am not familiar with how to , or what you mean by :
>
> "Open the Immidiate widow, and check what the Dmax returns
>
> ?DMax("Estimate_Number", "Table1")"
>
> can you clarify this for me, and I will do it
>
> "Ofer" wrote:
>
> > I tried the code, and it works, the only thing I can think of is that the
> > Dmax returns a null.
> > Open the Immidiate widow, and check what the Dmax returns
> >
> > ?DMax("Estimate_Number", "Table1")
> >
> > --
> > 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 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: Stop Code Execution
- Next by Date: Re: Form Validation
- 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):