Number Generating Question

Slides_Library

New member
Local time
Today, 12:54
Joined
Jan 29, 2008
Messages
5
I am building a data base for a Library and would like to generate a number in this form 1234567.123. The number is the Accession number for an image.

The first seven digits come from a book ID. So I want a table were I can enter the number and information about the book.

Then I want the number to be used by a different table with the addition of three other digits, which are images in the book, which I want to count automatically from .001 until I enter a new Seven digit number from a new book.

I thought I could have a query that grabs the seven digit number from a table. Then using Dmax and adding .001 to that number. But it will only give me this 1234567.001 not what I want, 1234567.001 then 1234567.002 then 1234567.003 and so on.

Another issue is I have is I dont know how to reset it when I use a new Seven Digit number like 7654321. Will it still count like above by .001 each time.

Thanks for any help you can give me in advance.

Slides_Library
 
You could try using a string field to be fed by concatenating to different integer fields.
 
Number Generating

How would I go about doing that.

Thanks

Slides_Library
 
Last edited:
Slides,

Make a new field in your images table --> ImageID

BookID: Integer
ImageID: Integer

ImageID = Nz(DMax("[ImageID]", "ImageTable", "[BookID] = " & Me.BookID), 0) + 1

Then whenever you reference it, refer like:

CStr([BookID]) & "." & Format([ImageID], "000")

Wayne
 
Thanks Wayne,

Can I put this as a default value or is there more to it.

ImageID = Nz(DMax("[ImageID]", "ImageTable", "[BookID] = " & Me.BookID), 0) + 1


Thanks
Slides_Library
 

Users who are viewing this thread

Back
Top Bottom