Question access 2010 form/table? help

HimAgain

Registered User.
Local time
Yesterday, 18:49
Joined
Sep 15, 2015
Messages
19
Hello everyone. Let me first apologize if I do not use the correct terms for things. I am new to access and have made only a few databases buy just figuring them out or with countless hours searching forms like this one for solutions. I a not very savy with VB terms and such and most of the time i'm like this :banghead:

Ok, So here is what i am needing help with. I have a field in my table labeled "Photo ID" that people can currently manually input the value to in a form. I need to be able to set the field to automatically generate a number in a certain format after the rest of the form has been filled out. The format being current Year "-" current month "-" the next number. For example the entries would look like 2015-09-350, 2015-09-351, etc. I cant seem to figure this out.

I also need to have a form setup so others can set a starting point for this number since it is being used as a backup database for when/if our current one goes down to keep the information correct when it is transferred over to the actual program we use. So if the last "Photo ID" entry is like "2015-09-351" we can set the next one to start at like "2015-09-490".

Again I am not great at VB or access. Any and all help would be greatly appreciated.

*Edit* Im not sure if it matters or not but this will be ran in access runtime enviroment.
 
can you just use the index on the record to make the 'photo id#'?
photoID= format(date(),"yyyy-mm-") & [ID]

(you ARE using record id right?) This way it is an automatic system with the 1 line of code above.
 
I am already using the primary key to link two table together that have different data in them.
But the photoID= format(date(),"yyyy-mm-") & does solve part of what i need.

If the index isnt the primary key let me know and i'll look and see.
 
OK i ended up getting it to work. Not sure if its the proper way or not but it works for me. Read below if you care to know what i did.

On my form i made an unbound text box named it numm and set default data to
Nz(Dlast("PhotoNum","PhotoNumTbl"),0)+1

another text box bound to my table with what i want to be shown
default value as Format(Date(),"yyyy-mm-") & [numm]

and another text box bound to my table to save the number used
default value as Nz(Dlast("PhotoNum","PhotoNumTbl"),0)+1

then i hid the first and last text box since no one needs to see them. Now when the for is filled out I get the format i wanted for a number and it saves the number used so i can reference it for next time.

As far as being able to change the starting point for the number i just made a form with a text box linked to the number and set it to show the last record. I can now change this number to where i need it and it wont effect anything else.

Sorry if my explanation sounds funky. I'm still trying to get use to Access lingo and the proper names of things.

Thanks again Ranman256 for the formatting help.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom