Results 1 to 9 of 9
  1. #1
    tezy1994 is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    5

    Adding Multiple Records

    Hi,

    I have a table with the following fields:

    InspID(AutoNumber)
    Crane Number
    RepairID
    AreaNumber
    Date Of Inspection
    Crack Length
    Image Path
    Inspector Name

    The main fields I am looking to update is the Crane Number and AreaNumber.

    A form should be able to update this 2 fields, the rest of the fields can remain blank. The Crane Number field is linked to another table where a list of Crane numbers are stored and I am thinking of using a combobox for the user to select a Crane number to update. They should only be able to add 1 crane at a time.



    1 Crane Number should automatically add 82 area numbers into the table. The 82 area numbers are stored in another table called Area Number.

    Is there any way to do this, and if yes how?

    Thanks

  2. #2
    drunkenneo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    199
    You can get all your answers in :
    http://www.datapigtechnologies.com/f...combobox2.html

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Adding 82 area numbers is adding 82 records. This will require some code. In VBA, like:

    CurrentDb.Execute "INSERT INTO tablename([Crane Number], AreaNumber) SELECT " & Me.combobox & " AS Crane, AreaNumber FROM [Area Number]"


    Advise no spaces in any field and object names.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    tezy1994 is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    5
    Hello, I can't seem to be able to access your link.

  5. #5
    tezy1994 is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    5
    Where exactly will I place this code? Into a button?
    Sorry, I am still pretty new to access and not familiar with this aspect of VBA codes.

    Alright I will try to remove the spaces in the names.


    Thanks.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    The real challenge is figuring out what event(s) to put code in. A button click is certainly one possibility.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    tezy1994 is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    5
    Quote Originally Posted by June7 View Post
    The real challenge is figuring out what event(s) to put code in. A button click is certainly one possibility.
    So I would just have to copy this exact code, CurrentDb.Execute "INSERT INTO tablename([Crane Number], AreaNumber) SELECT " & Me.combobox & " AS Crane, AreaNumber FROM [Area Number]"

    into a button click event?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    It is a generalized example. I don't know your data structure nor your form design. Certainly your table is not named 'tablename'.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    tezy1994 is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    5
    Thanks, I have managed to solve this issue with the following code

    CurrentDb.Execute "INSERT INTO Inspection(CraneNumber, AreaNumber) SELECT('" & Combo5.Value & "') AS CraneNumber, AreaNumber FROM [Area Number]"

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

Similar Threads

  1. Replies: 16
    Last Post: 02-06-2013, 09:23 AM
  2. Adding a date to multiple records in table
    By KChilly in forum Programming
    Replies: 9
    Last Post: 08-30-2012, 10:43 AM
  3. Replies: 5
    Last Post: 12-04-2011, 10:52 PM
  4. Adding multiple records from one form
    By sotssax in forum Forms
    Replies: 8
    Last Post: 07-17-2011, 11:16 AM
  5. Adding multiple records in subform
    By randolphoralph in forum Programming
    Replies: 1
    Last Post: 05-12-2010, 09:42 PM

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