-
Looping Problem - hope it's really basic!
Hi there
I'm not too great on databases but have made a quite simple one to store records of all my photos. All photo records are stored in one table, and they are in batches referred to by set number.
What I would like is a module(?) to run an insert query as many times as I specify so that say 100 records with set number 020 are inserted. I can then flick through these with a form and insert the unique data. I already have the Insert query as I am familiar with MySQL.
So I think I need some kind of looping statement, but having no experience of programming in Access, I'm kind of stuck. Any ideas anyone?
Any help much appreciated
Andrew
-
looping insert
Maybe this helps:
1. create a table to hold the value of number of loops; for example table = counter with field = value.
2. create an update query that decrements [counter]![value] by 1 for example
UPDATE [counter] SET [counter].[value] = [counter]![value]-1
WHERE (((counter.value)>0));
3. create a macro to run your insert query and the query from step 2.
4. create a form linked to the table from step 1.
5. create another macro to run the macro from step 3 for the number of times by setting the repeat expression argument to [Forms]![counter]![value]>0
6. Go back to the form design in step 4 and insert a macro button that references the macro in step 5.
-
Thanks for that, I'll have a go and see if I can manage it.
-
You could just set the default value of set to 020. That way every time you move to a new record on the form the value will be 020. Probably best to do this on the form. Right click on the text box for the Set value click properties to get the properties dialog. Find the "Data" tab and one of the options is default value. Enter 020 in here. You may need to put this value in quotes i.e. "020"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|