Trying to create field that generates sequential numbers

F

Forensic db

And nothign I've seen displayed works. I tried using the same method
exhibited on this model:
http://www.rogersaccesslibrary.com/download3.asp?SampleName=AutonumberProblem.mdb which tells me to put:

=DMax("Control name","Table name")+1

in the default value of the control properties, but I get #Error in the
field when I open it up in form view. I made sure that all the properties fro
my table and my form matched the model, but it simply doesn't work in my db.

Aaagh! I just want to keep a running count of specimens as they're
entered,as opposed to sutonumber which is no for human consumption, but all
of the recommendations I've found in these pages are either way above my head
or do not seem to work. Is this because I'm working with multiple nested
forms?

I also tried another recommendation cribbed from these pages, which looked
promising:

=Nz(DMax("main form","subformâ€,â€sub-subform","[control name]=control
name()"),0)+1

but this didin't work either. Does anyone have a relatively simple way of
generating a sequential, incremental counting field which will be bound to
the table?
 
A

Arvin Meyer [MVP]

=DMax("Control name","Table name")+1

should work just fine. I hope that you are changing "control name" and
"table name" to the actually names of these objects in your database.
 
F

fredg

And nothign I've seen displayed works. I tried using the same method
exhibited on this model:
http://www.rogersaccesslibrary.com/download3.asp?SampleName=AutonumberProblem.mdb which tells me to put:

=DMax("Control name","Table name")+1

in the default value of the control properties, but I get #Error in the
field when I open it up in form view. I made sure that all the properties fro
my table and my form matched the model, but it simply doesn't work in my db.

Aaagh! I just want to keep a running count of specimens as they're
entered,as opposed to sutonumber which is no for human consumption, but all
of the recommendations I've found in these pages are either way above my head
or do not seem to work. Is this because I'm working with multiple nested
forms?

I also tried another recommendation cribbed from these pages, which looked
promising:

=Nz(DMax("main form","subform¡,¡sub-subform","[control name]=control
name()"),0)+1

but this didin't work either. Does anyone have a relatively simple way of
generating a sequential, incremental counting field which will be bound to
the table?

I wish you had posted the actual expression you are trying to use
instead of the generic =DMax("Control name","Table name")+1 shown.

I suspect that your field and/or table names have a space in them. If
so, you must surround the name with brackets.

=DMax("[Control name]","[Table name]") + 1

should work.

Of course you know to change [Control Name] and [Table Name] to
whatever the actual names are.
 
F

Forensic db

Har! Thanks for the laugh! (And to be honest, thanks for checking because
that is exactly the kind of idiot thing I would do!)

I finally found a post from 2005 in which Klaatu suggested that the user's
problem was from "bad" table and control names which included forms. The fix
he offered was to put brackets around the offending table name within the
quotes, and when I tried that, it worked.
=DMax("[Skeletal_Inventory_ID]","[Skeletal Inventory]")+1
Problem solved!
Thanks for your help.
 
F

Forensic db

Yes Fred, that turned out to be exactly the problem! I just wish I'd posted
12 hours ago instead of stubbornly searching through years of old posts and
trying every option I found.

Thank you, you've helped me more than once.

fredg said:
And nothign I've seen displayed works. I tried using the same method
exhibited on this model:
http://www.rogersaccesslibrary.com/download3.asp?SampleName=AutonumberProblem.mdb which tells me to put:

=DMax("Control name","Table name")+1

in the default value of the control properties, but I get #Error in the
field when I open it up in form view. I made sure that all the properties fro
my table and my form matched the model, but it simply doesn't work in my db.

Aaagh! I just want to keep a running count of specimens as they're
entered,as opposed to sutonumber which is no for human consumption, but all
of the recommendations I've found in these pages are either way above my head
or do not seem to work. Is this because I'm working with multiple nested
forms?

I also tried another recommendation cribbed from these pages, which looked
promising:

=Nz(DMax("main form","subformâ€,â€sub-subform","[control name]=control
name()"),0)+1

but this didin't work either. Does anyone have a relatively simple way of
generating a sequential, incremental counting field which will be bound to
the table?

I wish you had posted the actual expression you are trying to use
instead of the generic =DMax("Control name","Table name")+1 shown.

I suspect that your field and/or table names have a space in them. If
so, you must surround the name with brackets.

=DMax("[Control name]","[Table name]") + 1

should work.

Of course you know to change [Control Name] and [Table Name] to
whatever the actual names are.
 

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