My Assistant
![]() ![]() |
|
|
Jul 17 2006, 01:13 PM
Post
#1
|
|
|
UtterAccess Enthusiast Posts: 86 |
Hi and thanks for the help. I'm going to state my problem and then afterwards state my proposed soultion. While I am asking for help with the solution if anyone has any better alternatives, that would be greatly appreciated. Thanks!
I have records that i want to attach a filename to. The filename doesn't have to be a field (and because of the complexity that I think I would be getting into if I made it a field, I would probably prefer that it just displays in an unbound textbox when you look at the record). The filename is in this format 031101-F-2006A-127.jpg the first 6 numbers (in this case 031101) i want to equal to the date that the record was added DDMMYY F is just a string 2006 is the year that the record is for (it's photos so the year corresponds the year the photo was taken and this year is a field called Year) A again is just a string And the last three digits are numbers used to designate the photo. This is the complicated part. I want these last three numbers to be a field because the rest of the filename is easy to generate. I want them to correspond to the photo number in that particular year. In other words, if I have 7 photos from 1947, the photos number would be 001,002,003...007. When I go to add a new record, after i select what year it is from, I want the field to automatically fill in the number photo that it is in that particular year. It might be easier to just see what I mean, so I've attached a picture of a drawing explaining things. I would really appreciate any help and if someone needs me to clarify things, don't hesitate to ask me. Thanks so much!
Attached File(s)
|
|
|
|
Jul 18 2006, 10:23 AM
Post
#2
|
|
|
UtterAccess VIP / UA Clown Posts: 25,205 From: LI, NY |
Actually this is an oft discussed technique of creating a sequential number. If you search UA on DMax, you should find other threads discussing it.
You are correct that this filename should NOT be stored since its constructed from other elements in your record. So you would have a field for CreateDate that is set to Now() as default. Another field for the either the picture date or the Year, if you don't have an exact date. Then you need a third field I'll call Increment. And that field would be a Long Integer field and would be populated by a DMax like so: =Nz(DMax("[Increment]","table","[PhotoYr] =" & Me.txtPhotoYr),0)+1 To build this file name you would use an expression like: =Format([CreateDate],"mmddyy") & "-F-" & PhotoYear & "A-" & Format(Increment,"000") & ".jpg" |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 19th June 2013 - 01:53 PM |