Results 1 to 5 of 5
  1. #1
    Mtyetti2 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    26

    Continuous form, carr over value

    I've seen several posts similar to this problem, but still can't find a solution. I have a continuous form set up to enter 'legs' for a vehicle database. Each record represents a portion of the drive. After entering the first leg, when I tab to the next record, is there an easy way to carry over the information from the previous record? ie: Driver, vehicle information.



    Not sure if I have to set a default value, or DLookup, or combination of both??? Any help is greatly appreciated.
    Thanks!

    Scott

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Requires VBA code to set the DefaultValue property. The code can go in the control's BeforeUpdate event procedure. Like:

    Me.Controlname.DefaultValue = "'" Me.Controlname & "'"
    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.

  3. #3
    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
    You can use the AfterUpdate event of the Control holding your data to set the DefaultValue for the Field. From that time forward, until you either manually change the data or close your form, the data will be entered automatically in each New Record.

    Code:
    Private Sub YourControlName_AfterUpdate()
       Me.YourControlName.DefaultValue = """" & Me.YourControlName.Value & """"
    End Sub
    This syntax is valid for Text, Number, DateTime and Boolean Datatypes.

    You’ll need to do this for each Control that you want to ‘carry forward.’

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Mtyetti2 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    26
    Missinginq,

    This is very close to what I am looking for. However, this code forces to the data to remain as the default value even when I close the form and reopen it. When I reopen the form, I would like all the fields to be blank, and then fetch the default values when I enter data on the new record. Hopefully this makes sense.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The form opens to existing records and displays data from the table, not the DefaultValue property.

    If you want the form to open only to New Record, can set the form DataEntry property to Yes.

    Or use the Access navigation bar to move to New Record.

    Or use code to move to New Record.
    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.

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

Similar Threads

  1. Replies: 2
    Last Post: 01-01-2014, 02:10 PM
  2. Non-continuous form
    By alyon in forum Access
    Replies: 6
    Last Post: 07-19-2011, 12:25 PM
  3. Replies: 1
    Last Post: 07-22-2010, 05:55 AM
  4. Replies: 6
    Last Post: 07-21-2010, 05:25 PM
  5. Continuous Form
    By duckie10 in forum Access
    Replies: 13
    Last Post: 06-09-2009, 11:15 AM

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