creating an answer based number of records

G

garath

When a user enters from a dropdown list a specific number,
I would like that this number be used to make that number
of records in a table.
A box contains 'a number of items' (to be user defined)
ex. 5, I would like that in a table 5 records are made,
without the user inputting records 1 to 5 (no more or no
less records will be made). Each record should contain the
number of that specific box, thus you get box1 item1
box1 item2, box1 item3....

Somebody has an idea ??
 
E

Eric Butts [MSFT]

Hi garath,

- Create a Append that appends the records as you need
- Create a Macro the runs the above Append query (example: "RunAppendQuery")
- Say you have a textbox control called "NumberOfTimes" where the user
enters the number of times to run the macro, the create a command button
with the following code behind it

Function MyCommandButton_Click()
DoCmd.SetWarnings False
DoCmd.RunMacro "RunAppendQuery", Me.NumberOfTimes, ""
DoCmd.SetWarnings True
End Function

- Of course if you are not into using Macros & Queries then here's a way
using strictly VBA code

Function AddRecords()
Dim i As Integer
For i = 1 To Me.NumberOfTimes
Currentdb.execute "SQL Syntax to append records"
Next i
End Function


I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights



--------------------
| Content-Class: urn:content-classes:message
| From: "garath" <[email protected]>
| Sender: "garath" <[email protected]>
| Subject: creating an answer based number of records
| Date: Mon, 27 Sep 2004 08:15:23 -0700
| Lines: 11
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| thread-index: AcSkpM9feZ1WRfLVTeWUlUfVrS0n6A==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.access.tablesdbdesign
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.tablesdbdesign:84339
| NNTP-Posting-Host: tk2msftngxa14.phx.gbl 10.40.1.166
| X-Tomcat-NG: microsoft.public.access.tablesdbdesign
|
| When a user enters from a dropdown list a specific number,
| I would like that this number be used to make that number
| of records in a table.
| A box contains 'a number of items' (to be user defined)
| ex. 5, I would like that in a table 5 records are made,
| without the user inputting records 1 to 5 (no more or no
| less records will be made). Each record should contain the
| number of that specific box, thus you get box1 item1
| box1 item2, box1 item3....
|
| Somebody has an idea ??
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top