Results 1 to 9 of 9
  1. #1
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476

    Repeating same Data to the next/new Record

    I hope that there’s a simple way to achieve my objective. Say I have 4-fields in a query/form, 3-of the fields contains the same data from the previous Record pretty much contain for the follow 4 to 5 new Records. Is there or what is the code to have a field (or fields) be repeated from the previous Record? This is more dealing with Forms rather than queries. Sometimes I come here asking question & I feel as though I made sense, where many of you guys weren’t following me/understanding me. However, in this thread/question I may not be making sense & may need to elaborate some more.

    Let me provide an example:


    The 4-fields are,: 1) Zip Code, 2) PostOffice, 3) County, & 4) Map#
    When inputting these 4-flds of data in a Form, the first 3-flds are the same, but every ZipCode/PostOffice might be on 3 to 5 Map Pages.

    19001 -- Abington – Mnt – 3258
    19001 -- Abington – Mnt – 3259
    19001 -- Abington – Mnt – 3370
    19001 -- Abington – Mnt -- 3371

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Try this type of thing, but in the after update event of each control:

    http://access.mvps.org/access/forms/frm0012.htm

    There's also:

    http://allenbrowne.com/ser-24.html
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    Paul,

    I tried:
    Private Sub Co_AfterUpdate()
    Const cQuote = """"
    Me!Control.DefaultValue = cQuote & Me!Control.Value & cQuote
    End Sub

    Private Sub PostOffice_AfterUpdate()
    Const cQuote = """"
    Me!Control.DefaultValue = cQuote & Me!Control.Value & cQuote

    Private Sub ZipCodes_AfterUpdate()
    Const cQuote = """"
    Me!Control.DefaultValue = cQuote & Me!Control.Value & cQuote
    End Sub

    It's not working

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    "Control" needs to be the name of the control (textbox or whatever). Try:

    Code:
    Private Sub Co_AfterUpdate()
       Const cQuote = """"
       Me!Co.DefaultValue = cQuote & Me!Co.Value & cQuote
    End Sub
    I personally would declare the constant once in a standard module rather than in each sub.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    Paul,

    I figured it out. I needed to put the field's name in place of 'Control' for each field

    Thanks!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    You must have missed post 4? Glad you got it sorted out in any case.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    Hey Paul,

    In a Form (in Datasheet View) how do I set a sort order? I want it to sort according to the ID (Autonumber), but I can't figure it out. It's probably very simple, i'm just missuing it

  8. #8
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    Paul,

    Nevermind, I think I got it. I sorted the desired field by clcking on top of the field's name (right side), chose 'sort/ascending, & made sure to save the Form. When I reopened the Form it seems to be sortedx as I set it.

  9. #9
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    For future reference, in Form Design View you can go to Properties-Data and in the OrderBy Property enter the Field Name enclosed in Square Brackets: [ID]

    Make sure that the 'Order By on Load' Property is set to Yes (which is the Default.)

    Linq ;0)>

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

Similar Threads

  1. Data in subform records repeating
    By skatiekat in forum Forms
    Replies: 2
    Last Post: 11-01-2012, 12:50 PM
  2. Repeating Function
    By Code5OnYou in forum Forms
    Replies: 4
    Last Post: 01-12-2012, 01:55 PM
  3. Repeating info on form
    By bjr001 in forum Forms
    Replies: 1
    Last Post: 11-16-2010, 01:58 PM
  4. Repeating data in a field for a new record
    By NOTLguy in forum Forms
    Replies: 3
    Last Post: 10-29-2010, 07:27 PM
  5. Repeating Records
    By windwardmi in forum Reports
    Replies: 13
    Last Post: 05-22-2010, 02:54 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