Results 1 to 11 of 11
  1. #1
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283

    Update Query Help

    Hello guys,



    I have a table called Table1 and fields called Field1 and Field2 and other fields that are populated. I have over 18,000 records, but I need Field1 and Field2 to be populated.

    Field1 Field2
    1 100
    2 100
    3 100
    4 100
    4 075
    4 050
    4 025

    I need Field1 and Field2 to be populated like this throughout my table. Idk if there is a query that can do this or not. Or do I need to code this. Thanks for your help

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Populated with what? Start with 100 and subtract 25 for each following instance of Field1? I can't envision a query that can do it. I'd use VBA and loop the table, sorted on Field1, which I assume is already populated.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    What are the rules for populating these two fields? Why do you have records with 1,2,3 in Field1 but same value in Field2 and 4 records with 4 in Field1 but different values in Field2?

    Will probably need VBA.

    EDIT: see Paul's reply now - agree with
    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
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    what happens if field1 has more than 5 entries?

  5. #5
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283
    Field1 and Field2 are null. And I just need these fields filled with the data I provided over and over again till the last record

  6. #6
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    Is this a one time need, or an ongoing thing.
    If one time. You could create the columns however you want in Excel, then import into Access or copy/paste into the table.

  7. #7
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283
    this is an ongoing things. Like once I import a new file I need those fields to loop that data in until the last record in

  8. #8
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    you need to explain the pattern better. In your example field 1 goes up to 4 and then sticks there, does it stay there forevermore? Field 2 starts at 100 for 4 records, then starts decreasing by 25, what happens when it gets to 0, does it go negative. I don't understand the pattern.

  9. #9
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283
    Like I need those two fields to repeat themselves after they get to 4 and 025. and just keep repeating that set up numbers until the end of the file. starting at 1 and 100

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why? What is purpose of these fields? Why do you have 18,000 records with these fields empty? What is in the other fields? Does it matter which records are assigned these value pairs?

    The example give does not fit that latest rule.
    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.

  11. #11
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    So hard code the first 7 records, then write 4 025 to all the records with null.
    Or call a function which is counting which record your on and once the record is past 7, then return 4 025.

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

Similar Threads

  1. Replies: 14
    Last Post: 08-12-2014, 06:33 AM
  2. Replies: 7
    Last Post: 08-26-2013, 06:05 AM
  3. Replies: 1
    Last Post: 05-17-2013, 12:53 PM
  4. Replies: 2
    Last Post: 08-30-2012, 07:59 AM
  5. Replies: 4
    Last Post: 11-10-2011, 03: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