problem in access..

  • Thread starter asset number via AccessMonster.com
  • Start date
A

asset number via AccessMonster.com

'Guys need help. How can I do this in Ms access
'My prof has assigned this project to us and im really not into access. i
know a bit of it
'but im not good at it.
'Here's the prob.
'I have two textbox namely year of birth and number
'Now what I need to do is to count the number of user who enters the same
birth year
'for example the user inputs 2004, 001 will automatically be displayed on the
number textbox
'If on the next record the user will also input 2004, 002 will automatically
be displayed
'on the number textbox. Now if on the next record the user will enter a
different year example:
'the user enters 2005, 001 will automatically be displayed on the number
textbox.
'How can i do this?Thanks and hope you can help me.
 
G

Guest

In the After Upate event of the year of birth text box (bad idea to use
spaces in names of objects):

Me.Number = Nz(DMax("[NumberFieldName]", "TableName", _
"[YearFieldName] = " & Me[year of birth]),0) +1

Change NumberFieldName to the name of the field in your table where you
carry the number you want to increment.
Change TableName to the name of the table where the data is.
Change YearFieldName to the name of field in your table that has the year.
The above syntax assumes YearFieldName is a numeric field. If it is a text
field, the syntax will be:
Me.Number = Nz(DMax("[NumberFieldName]", "TableName", _
"[YearFieldName] = '" & Me[year of birth] & "'"),0) +1
 

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