Re: 2007 Access



Salad,

RE:below

I have changed the field to just a plain numeric field now based on advice
that I should not use a key autonumber field to create JOB NUMBERS. What
should I put in the control source to make the number increment by one and
start at 550000.

So that every time I tab past the first field a new order number is created
but not saved until the last required field is entered, what I want to do is
raise a new job for work coming in for calibration.



"RASTUS" <rcuf@xxxxxxxxxxx> wrote in message
news:13au5t8en3fnrcc@xxxxxxxxxxxxxxxxxxxxx
Thanks salad I will read up on Dmax and see if I can work out what you are
doing there
I'm a bit of a novice with this, I have done an advanced access course but
I think they just hand those pieces of paper out like toilet paper.
Regards


"salad" <oil@xxxxxxxxxxx> wrote in message
news:e_Ari.13670$Od7.11955@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Cab man wrote:

I am constructing an order number and a Job number based database and I
want the order numbers to automatically increment to the next number, I
currently have used a combined key to achieve this but don't know how to
make both parts of the key display on the form and don't know how to
make the number increment starting from a given number say 550000, can
anyone help, possibly I should not use the key field to achieve the
desired effect?

Sub IncTo550000
Dim rst As Recordset
Dim lngFor As Long
Dim lngStart As Long

'this will inc the autonumber of table TEST
Set rst = CurrentDb.OpenRecordset("Test", dbOpenDynaset)

'get the current max id in the table Test (autonumber named ID)
lngStart = NZ(DMax("ID","Test"),0) + 1

'now increment the autonumber in the table
For lngFor = lngStart To 550000
rst.AddNew
Next

rst.Close
Set rst = Nothing
End Sub





.



Relevant Pages

  • Re: 2007 Access
    ... Dim 1ngID As Long ... I have changed the field to just a plain numeric field now based on advice that I should not use a key autonumber field to create JOB NUMBERS. ... What should I put in the control source to make the number increment by one and start at 550000. ... Dim lngID As Long ...
    (comp.databases.ms-access)
  • Re: 2007 Access
    ... Dim 1ngID As Long ... advice that I should not use a key autonumber field to create JOB ... increment by one and start at 550000. ... Dim lngID As Long ...
    (comp.databases.ms-access)
  • Re: 2007 Access
    ... I have changed the field to just a plain numeric field now based on advice that I should not use a key autonumber field to create JOB NUMBERS. ... What should I put in the control source to make the number increment by one and start at 550000. ... Dim lngID As Long ... Dim rst As Recordset ...
    (comp.databases.ms-access)
  • RE: Event Procedure
    ... Dim rst as ADODB.Recordset ... Set rst = new ADODB.Recordset ... Dim AutoNumber As Long ... ' db.Execute jetSQL, dbFailOnError ...
    (microsoft.public.access.modulesdaovba)
  • RE: Event Procedure
    ... Dim rst as ADODB.Recordset ... Set rst = new ADODB.Recordset ... Dim AutoNumber As Long ... ' db.Execute jetSQL, dbFailOnError ...
    (microsoft.public.access.modulesdaovba)