Results 1 to 2 of 2
  1. #1
    gook is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2013
    Posts
    1

    Question Create form to create multiple entries in simple table?

    Forgive me as I am VERY green in Access and only know some simple coding...

    I have a simple table that logs "Drawing Numbers" (unique AutoNumber) with "Date Created" and "Initials" of the person who takes the number. What I am trying to do is make a form to ask: "How many numbers do you want?" and "What are your Initials?" from simple unbound text boxes.

    I need to write some code to enter the information into the table (i.e. the next 10 numbers - if the number of drawings required is 10, todays date and insert the Initials into the table. How would I go about doing this?

    Also, once done I would like to have a popup window to display the actual "drawing numbers" as they were saved to the table??

    I hope this makes sense?

    The database will be accessed by multiple people at once so as soon as the numbers are allocated the (button on the form) the table is updated so that two people cannot take the same number etc.

    Thanks in advance!

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    How many people are going to be using this database and how frequently.

    If you have 20 users but they are likely only going to use it 1 time per day or 1 time per week it's a much different issue than if you have 20 people accessing it 1 time per minute.

    Access is not a great tool for multiple concurrent users with edit/add ability.

    Let's say you have a form called

    Frm_CreateDrawingNumbers

    on that form you have a field for the person's Initials and a number of drawings to be added

    Let's call those fields fld_Initials and fld_MaxDrawings

    Let's also assume your log is called tbl_Log

    in the ON CLICK event of a button you would have the following:

    Code:
    dim db as database
    dim sSQL as string
    dim iCurrMax as long
    dim iMaxDrawings as integer
    dim sInitials as string
    dim i as long
    
    'this gives you the current maximum drawing number
    icurrmax = dmax("[Drawing_Number]", "tbl_Log")
    
    imaxdrawings = fld_maxdrawings
    sIntials = fld_initials
    
    set db = currentdb
    
    'this adds the records to the database
    for i = 1 to imaxdrawings
         sSQL = "INSERT INTO tbl_Log (Drawing_Number, Date_Created, Initials) VALUES (" & icurrmax + i & ", #" & now() & "#, '" & sinitials & "'")
         debug.print ssql
         db.execute (sSQL)
    next i
    
    set db = nothing
    then all you'd have to do is show the most recent x where x is the number of drawing numbers they requested for a specific set of initials which should be trivial if you use the now() when create a date/time stamp

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

Similar Threads

  1. need to create sub-forms with multiple entries
    By asinha9 in forum Database Design
    Replies: 2
    Last Post: 03-20-2013, 07:04 PM
  2. Create multiple entries with same data
    By swavemeisterg in forum Forms
    Replies: 6
    Last Post: 05-30-2012, 10:16 AM
  3. Replies: 3
    Last Post: 11-16-2011, 11:53 AM
  4. Replies: 1
    Last Post: 09-21-2010, 09:49 AM
  5. Replies: 3
    Last Post: 06-01-2009, 01:41 PM

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