View Single Post
  #2  
Old June 26th, 2009, 01:25 AM posted to microsoft.public.access.tablesdbdesign
Steve[_72_]
external usenet poster
 
Posts: 190
Default Trying to get a field to generate contents automatically on a form

All classes rider numbers are stored in the one table at this stage.

DON't change that; you have done that correctly!!

To get the next largest rider number, you need to look in your table for
only the class in question and then find the highest recorded rider number.
You can do this with the DMax function in Access which you can look in the
Help file for.

NextRiderNumber =
DMax("[NameOfRiderNumberField]","NameOfYourTable","[NameOfClassField] = '" &
Forms!NameOfYourForm & "'"") + 1

Note 1 Three single quotes after the equal sign
Note 2 Three single quotes and a double quote after the & sign at the
end.

Steve



"NDBC" wrote in message
...

I am trying to use access 2003 to record rider details and keep lap times
at
a local enduro race. I am trying to input riders details. There are a few
classes of competitors, a grade (rider number 100-199), b grade (rider
number
200-299) etc. I have set up an optiion group for rider class so if a grade
is
ticked it comes back with the response 100 and 200 for b grade etc. What I
need in the rider number box is the next available rider number to be
generated automatically. For instance if the a grade option is ticked and
the
largest rider number in the 100's already stored in the table is 103 then
it
automatically comes up with 104 as the rider number. All classes rider
numbers are stored in the one table at this stage. Does it make it easier
if
I have a table for each class. I don't know how to make a form look at
multiple tables.

I have developed a query that can determine the highest number used in any
class based on an input of (100, 200 etc) but don't know how to use a
query
from a form if this is an option.

I have a very limited experience with access and vba so may need very
detailed help if possible but any advice will be gladly accepted.

Thanks