Numbering scheme

asad.saeed

Sharp Killer
Local time
, 01:00
Joined
Nov 28, 2008
Messages
30
I am designing numbering scheme, where I’ve a problem

There is a form in which has Field A (numeric), I want to add new (Generate new
) value by pressing button with define offset value.

i.e.

Field A
1
5
10
12

Now I want to add new number with 3 offset
So the next record should be 15

Can any body help me

File is attached
 

Attachments

This will do the job:

Code:
Private Sub Command4_Click()
If Not IsNull(Me.Offset) Then
  Me.A = DMax("[A]", "Table1") + Me.Offset
Else
  MsgBox "You Must Enter an Offset Number!"
  Offset.SetFocus
End If
End Sub
It checks to make sure that an Offset value has been entered, then adds it to the highest value for A that already exits.

If there's no value in A a message pops up reminding the user to first enter a value.
 
There is confusion. Your code work fine but I want to add offset value in new record

i.e.
ID | A Filed
1 | 2
2 | 8
3 | 10

Now I give offset value 2 so the next record shall be in A field

4 | 12

And every time I press button it will make new record with define offset.
Hope you understand
Thanks in advance
 

Users who are viewing this thread

Back
Top Bottom