Results 1 to 9 of 9
  1. #1
    Sankofa is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    5

    Updating a field in Table1 with the data from Table2 ... but wait, there's more!


    I need to assign a user from the list of users in the User Table to an existing record in the "Assigned To" field of the Main table.

    I know that I may have to implement a vba module to loop through the list of users to update the field in the main table - or - there may be a simpler way, but I'm an access newbie, and I have no idea how to go about this. I've been reading forums and textbooks since the start of business yesterday, and I haven't found a response that I think is on point.

    If there is already a thread that explains how to do this I'd appreciate it if someone could point it out, because I couldn't fine it (and I really did look!)

    Thanks in advance for your help,
    Desperate

  2. #2
    Sankofa is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    5
    Oh, I forgot to tell you ... There will only be 4 users in the User table, and I need for any fields in the Main table to be assigned a User (equally) ... so if there are 12 records in Main where the Assigned To field is empty, Each of the 4 users in the User table will be assigned to 3 records in the Main table.

    Sorry I didn't get this into the first post, I'm frustrated!

  3. #3
    Kirsti is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172
    How are the Users in the User Table assigned to the Main Table? What is the relationship between the tables?

  4. #4
    Sankofa is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    5
    The Main table has a field called "UserID" which corresponds to the "ID" field in the User table

  5. #5
    Kirsti is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172
    So can't you just create an IIf statement?

    IIf([tblUser.ID]Is Null, [tblMain.UserID],[tblUser.ID])

    Or am I missing something?

  6. #6
    Sankofa is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    5
    This database is serving to assign each user in the User table to a record in the Main table until all of the Main records have been assigned and there are no remaining null Assigned To fields. If there are 40 records in the Main table where the Assigned To field is null, and there are 4 users in the User table, each user would be assigned to 10 records in the Main table.

  7. #7
    Kirsti is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172
    Ok, but that goes back to what I was asking earlier. How do you know which 10 records in the Main table each of the 4 users are assigned to? What criteria determines this?

  8. #8
    Sankofa is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    5
    Sorry ... this must seem like pulling teeth, and I apologize. The records will be assigned to the Main table only when the Assigned To field is null.

  9. #9
    Kirsti is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172
    Ok, so why can't you put the IIf statement I posted above in the Assigned To field?

    This doesn't seem very complicated to me, so I assume that means that I'm missing something. Please post more information.

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

Similar Threads

  1. Copy values from table1 to table2
    By wubbit in forum Queries
    Replies: 2
    Last Post: 04-19-2012, 04:40 PM
  2. wait and shell
    By maxbre in forum Programming
    Replies: 19
    Last Post: 11-03-2011, 11:10 AM
  3. Replies: 4
    Last Post: 08-04-2011, 02:57 PM
  4. Replies: 5
    Last Post: 08-20-2010, 06:40 AM
  5. Use Table1 to update Table2? Urg Help needed
    By munkifisht in forum Queries
    Replies: 1
    Last Post: 07-24-2009, 08:00 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