DCount in Form

GMP1978

New member
Local time
Yesterday, 20:39
Joined
Aug 15, 2012
Messages
5
I have a form that just became corrupted and I am attempting to rebuild, but I cant get one last piece.

The form has 4 fields
-Guidance Source Identifier
-Calendar Year
-Guidance Type
-Sequence Number

The first three fields the employee keys in the document number, the 2 digit year, and the type of document it is. I need to have a Command Button they click that generates the Sequence Number based on the 3 fields they just populated to ensure there is no duplicates.

Ex. In January I update AR 672. I would have entered 672 in Guidance Source, 12 in Calendar Year, and AR in Guidance Type. Today I need to update this document. I would then key into the database the exact same information as above, but when clicking on the Command Button it would populate 2 into the Sequence Number field since this is the second version.

I was able to find this code within the old database, but I don't understand how I need to imbed it into the new database to make the Command Button do what it is suppose to do.

I have attached the database. Thank you to whoever is smarter than me and can help me!!!!

Me!Sequence Number = (DCount("[Guidance Source Identifier]", "Guidance Table", "[Guidance Source Identifier] = '" & Me.Control1 & "', [Calendar Year] = '" & Me.Control2 & "', [Guidance Type] = '" & Me.Control3 & "'") +1)

Thank you
Gary
 

Attachments

Thank you very much... it was very close.. I just added +1 to the end of the code and it works perfect.

Thank you!
 

Users who are viewing this thread

Back
Top Bottom