Create automatically records into subform

jealindgar

JLGarcia
Local time
Today, 08:41
Joined
Aug 5, 2007
Messages
35
Hello
there is a field in my form named "numphotos" and I write the number of photos than that folder contains.

I have a subform in that main form named "descriptions", here I describe, one for one, all photos of that folder.

Itsn´t a problem if the folder contains a few photos, but I have folders that have even 100 photos :confused: then I must to create 100 records in my subform :eek:

I would like than Access create those records automatically according to the number of photos that I indicate at the field numphotos.

My example in photo: http://farm2.static.flickr.com/1141/1093088982_a084bff95f_o.jpg

I only would desire that Access create that many lines to me as I have written on "numphotos". I would write the rest of the information (photographer and description)

is it possible?

thanx!!

windowsXP
access 2007
 
This is certainly possible, but I suspect it will not be a trivial task.

I'm betting that you will need to call an API to expose the directory listing to Access, count the photo files and add the names. Then you can finish it yourself.

Also, if you require that each subform record have a description, then you cannot apply the rule at record level, but rather enforce this via VBA.

For starters, go and search forums/google for "file dialogs", "browse directory" to get some sample of APIs used, read up on how you will handle API.

Good luck.
 
Ok!! then "file dialogs" or "browse directory", I´ll search them.

My level is very basic, but very bery basic ;)
 
ufff, i don´t understand nothing, well, i´ll continue making them manually :(
but thanx
 
hello again!
I don´t have obtained my intention. :(
I think that the best solution is to create a button in the subform that allows me to do what I want.

what do you think?

thanx to all!
 
solution???

The easiest way i can think of is to create a button on your main form. This button will run an insert sql statement that loops the number of times in your numphotos field.

I don't have access on this computer to test but i think the code would be similar to this.

' variable that will increase each time you insert new subform record
Dim vCount as integer

Set vCount = 0

do until vCount = me.numphotos

'this sql will insert the subrecords into your table
docmd.runsql "insert into tablename (columnA, columnB) Values (1,2);"

set vCount = vCount+1

Loop


hope this helps!!

Ant
 

Users who are viewing this thread

Back
Top Bottom