RE: manually incrementing number code does not work in a2003



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
> > >
.



Relevant Pages

  • RE: manually incrementing number code does not work in a2003
    ... > 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? ... >>> can refer to it. ... >>> Thank you and Good luck ...
    (microsoft.public.access.formscoding)
  • RE: Names.Add Name - RefersToR1C1
    ... In explanation regarding the deletion of the columns: the Loop ... information that will ultimately be transferred from Sheet2 into the Template ... together with 'Table1' are all inserted onto Sheet4. ... Sub MakeTable ...
    (microsoft.public.excel.programming)
  • Re: Referring to form objects from inside a thread pool
    ... but I don't think it's good practice to refer to specific ... reference to an instance of the form in the thread class and then whenever ... Private Delegate Sub DoSomething_Delegate ...
    (microsoft.public.dotnet.languages.vb)
  • Re: unlocking a recordset
    ... Form1 with a combo list where the record source is field1 of table1. ... >> On a form I have a button that trigger the above sub. ... >> 1) IF I click on the button of the above sub, everythig is fine. ... >> So I to refresh the combo list and not have the tbale locked so I can ...
    (microsoft.public.access.queries)
  • Re: How to refer to controls in a Sub
    ... "Filip Neyt" wrote in message ... In the Sub below, I don't know how to refer to the control om the TabControl of the form. ... Dim strKader As String 'Rectangle subform ...
    (microsoft.public.access.modulesdaovba)

Loading