Results 1 to 6 of 6
  1. #1
    enolan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Location
    West Virginia
    Posts
    3

    Using a Form to input multiple copies of a record

    Hello AccessForums Community,
    I am currently searching for a way to input multiple instances of the SAME information into a table by using a form.


    For instance, in order to keep track of specimens, I must have a record of each single individual. Each specimen record contains a [collection number], [species], and [gender] (e.g.: 070607-01, Fallicambarus fodiens, Female) with the species and gender being selected from a drop-down box.
    Ultimately these link back to sites where they were collected via a many-to-one relationship using the [collection number]...not that it matters.
    Rather than input this same data 10 times, is there a way to input the appropriate data, select a number of iterations, and press a button to save these as 10 records?
    Thank you all for your help in advance--this is driving me nuts.
    -Joe

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Welcome to the forum!

    Absolutely nothing changes for each of individuals within the group? Not even a tracking number? If so, how would you distinguish them?

    I would recommend using an unbound form with the text and combo boxes you mentioned. Add a button and the code behind that button would run an append query based on the number of iterations the user enters via a text box on the form.

    The basic code in the on click event of the button would look something like this (air code, not tested). You will have to delineate values for text fields with single quotes and # signs for date fields. Numeric values do not need to be delineated.

    Code:
    dim mySQL as string
    dim i as integer
    
    mySQL= "Insert into tablename (field1, field2, etc) "
    mySQL= mySQL & "Values (" & me.combobox1 & ", " & me.combobox2...")"
    
    For i=1 to me.NameOfTextboxWithIterations
    
    currentDB.execute mySQL dbfailonerror
    
    Next i

  3. #3
    enolan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Location
    West Virginia
    Posts
    3
    JZWP11,
    Forgive me for the brainfart, can you explain "unbound" in regards to the form? These specimens will be stored in jars, ultimately in a museum, and cataloging them via MSAccess is required (for reasons beyond my control). I don't agree with the logic of the State DNR, I just grin and bear it :-)
    I'll give your code a try and report back by the end of the day. Thank you for all the help!
    -Joe

  4. #4
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    An unbound form is just a form that is not bound to a table or query. Most typical data entry/review forms in Access are bound to a table so that you can scroll through the individual records in a table. For an unbound form, you would not see any data & you will not be able to scroll through records since you are not bound to a records source (table/query).

  5. #5
    enolan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Location
    West Virginia
    Posts
    3
    JZPW11,
    I have to thank you immensely, the code worked wonderfully--however in playing around with it, I found that it does not like Boolean values. This tangential information aside, is there a way to have the form fields clear after the button is pressed? As the presence of the [collection number] is required, if even that field were the only one automatically cleared upon clicking the button, then unintentional writes could be avoided.
    Thanks again for your crucial help!!

  6. #6
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    ..is there a way to have the form fields clear after the button is pressed
    After the FOR...NEXT loop, you could set the textbox controls on the form to NULL


    me.textboxcontrolname=Null

    I found that it does not like Boolean values
    How so?

    I'm guessing that you have to check whether the check box (I assume) is checked (value =-1 ) or not checked (value=0 or any value other than -1)

    mySQL= mySQL & "Values (" & IIF(me.checkboxname=-1,-1,0) & ",...)"

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 12-05-2011, 01:55 PM
  2. Replies: 5
    Last Post: 07-18-2011, 12:18 PM
  3. labeling multiple copies
    By tgavin in forum Reports
    Replies: 1
    Last Post: 05-11-2011, 05:07 PM
  4. Replies: 1
    Last Post: 12-13-2010, 04:06 PM
  5. Printing multiple copies of a mailing label
    By Flight Planner in forum Reports
    Replies: 1
    Last Post: 10-19-2006, 08:16 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums