Access Q&A: Criteria, Numbering
By Richard Rost 16 years ago
Here are some more Access questions I've answered recently. If you want to submit one, visit my TechHelp page.
I have problem with the database im working i am inputting a number 2.5 and it automatically round off to 3. What expression should I code to be able not to round off the number. Hope you can help me.
Sounds to me like your table field is set to either INTEGER or LONG INTEGER. Change the field data type to DOUBLE, SINGLE, or DECIMAL and your problem should go away. If this is NOT the case, let me know.
I cover this topic in detail in my Access 101 and 102 tutorials.
I would like to number records based on their filter.
For example. If I add sessions to a class ID. I would like the sessions to number themselves from 1, 2, 3 etc based on their dates. Is this possible?
Anything is possible in Access, but I'd need to know more about exactly how you want to number them. I don't know exactly what you mean by "based on their filter."
If you just want to assign them numbers (1,2,3,etc.) as they're entered into a form, then you can just use a little bit of VB code in the BeforeInsert event for the form:
LargestNumber = DMAX("Session","MyTableT")
Session = LargestNumber + 1
That will basically look up the largest number in the field called Session in your table, and set the Session field on your current form to that value +1.
If that's all you need, there ya go! I cover VBA and topics like this in my Microsoft Access 301 tutorial. See my web site for details.
Subscribe to Access Q&A: Criteria, Numbering
Get notifications when this page is updated