Permanent custom numbering

Keeperen

Registered User.
Local time
Today, 21:21
Joined
Jun 26, 2012
Messages
19
Hello Forum,

I have this problem.

I have this project DB where I have a problem recording tool.

Each problem has an ID (P-key), but it needs to have problem ID as well. The problem ID must start from 1 and continue towards x at each project.

To describe the above with an example:

ID Problem ID Project Problem
1 1 A Bla bla.
2 2 A Bla bla.
3 1 B Bla bla.
4 2 B Bla bla.
5 3 A Bla bla.

The Problem ID must never change when first appointed to a problem.

How do I do that ?

In advance thanks. :-)
 
Last edited by a moderator:
Re: Permanent costum numbering

Have a look at the attached DB which uses the DMax() function plus one to create a Customs Auto Number.

Specifically look at the code behind the After Update event of Combo4
 

Attachments

Hello Again,

Now it is my syntax in the VBA that is wrong. I have no clue when to use " & ´ ect. Can someone link to a beginners site for VBA users ?

Next question.... Where is my mistake in the following, the error is somewhere in the Dmax( function or Nz( function : :D


Private Sub Sagsnummer_AfterUpdate()

If Me.Aftaleseddel_ID = 0 Or IsNull(Me.Aftaleseddel_ID) Then
Me.Aftaleseddel_ID = Nz(DMax("Aftaleseddel_ID", "T_Aftaleseddel", "Sagsnummer =" & Me.Sagsnummer & " And Aftaleseddel_ID=" & Me.Aftaleseddel_ID &) + 1, 1)
Me.Vedrørende.SetFocus
Me.Sagsnummer.Locked = True
Me.Sagsnummer.Enabled = False
End If

End Sub

Private Sub Form_Current()

Me.Vedrørende.SetFocus

If Me.Aftaleseddel_ID = 0 Or IsNull(Me.Aftaleseddel_ID) Then
Me.Sagsnummer.Locked = False
Me.Sagsnummer.Enabled = True
Else
Me.Sagsnummer.Locked = True
Me.Sagsnummer.Enabled = False
End If



End Sub
:-)

In advance thanks.
 
To start ..


And Aftaleseddel_ID=" & Me.Aftaleseddel_ID &) + 1, 1) ==>

And Aftaleseddel_ID=" & Me.Aftaleseddel_ID ) + 1, 1)

& Used to force string concatenation of two expression ....
After "Me.Aftaleseddel_ID" no more strings to connect and build conditions for Dmax

Check...
 

Users who are viewing this thread

Back
Top Bottom