help on simple automated numbering database plz?

L

Liam T

hi to all.

firstly this is my first db in access since i was at college 9 years ago -
and access has changed greatly! so im confused hehe

all i need to do for this first simple project is to create a form that
allows users to select one of our departments (only 4). Then, when a button
is pressed, the form creates a new contract number based on the department
and the next consecutive number available. so each dept would need its own
number list. i would then need the form to email someone in our company with
this contract number

now, i am a competant designer as ive been developing on the lotus platform
for years now (but have just moved to a new MS only office), i just dont know
where to start on access nowadays. could someone point me to a good example
to start on or some quality tutorials that i can quickly read up on.
 
L

Linq Adams via AccessMonster.com

I think this will get you started in the right direction. Substitute
(carefully!) your object names for those in the example.

Table name:

YourTableName

Table field names:

Field for the department name is DepartmentID
Field in the table holding the contract number is ContractID

Form control names:

Control holding the department name is DepartmentName
Control holding the contract number is ContractNum

Then this code behind your command button should work:

If Me.NewRecord Then
If Not IsNull(Me.DepartmentName) Then
Me!ContractNum = Nz(DMax("ContractID", "YourTableName",â€[DepartmentID] ='"
& Me.DepartmentName & "'"),0) + 1
End If
End If

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top