Results 1 to 7 of 7
  1. #1
    Magnus1982 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2017
    Posts
    29

    Default value from previeus form

    Hi,

    I have table and form for this table.


    I am looking way to have deafault value in one of field in next blank page of may form.

    Example i writing parts numer for batch of product and 100 of them have the same that's why i need in next record default value from previous form. If the parts numer will change i will just change one time and again i will have default numer untill next batch.

    I try to do that using code from internet but is not working. Maby i am doing something wrong . Pleas explain me very simple way.

    A lot of regards

  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,815
    What code did you attempt? Post it for analysis.
    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
    Magnus1982 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2017
    Posts
    29
    from this

    https://access-programmers.co.uk/for...d.php?t=120910

    maby i am doing something wrong when i am implement this to the access

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Have an unbound invisible textbox on the form, e.g. HoldDefault.

    In the AfterUpdate of PartNum:
    Code:
    Private Sub PartNum_AfterUpdate()
    Me!HoldDefault = Me!PartNum
    End Sub
    In the form's OnCurrent:
    Code:
    Private Sub Form_Current()
    If Not IsNull(Me!HoldDefault) And IsNull(Me!PartNum) Then Me!PartNum= Me!HoldDefault
    End Sub

  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,815
    Post YOUR code for analysis.

    If you want to carry a value into next new record of a form, review http://access.mvps.org/access/forms/frm0012.htm
    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.

  6. #6
    Magnus1982 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2017
    Posts
    29
    Hi,

    I will attach my file. I need in form Laser Montarz every time when i will press button new . The value of " BatchDiody" was like previouse.
    Attached Files Attached Files

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    I don't use macros, only VBA. I don't think a macro can accomplish this so VBA:

    Code:
    Private Sub Polecenie118_Click()
        Me.[Batch Biody].DefaultValue = """" & Me.[Batch Diody] & """"
        DoCmd.GoToRecord , "", acNewRec
    End Sub
    This should work but I get error: "The expression On Click you entered ... A problem occurred while ... communicating with ..."

    Which is odd because it works in my own database.


    Recommend no spaced or punctuation/special characters in naming convention.
    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: 1
    Last Post: 03-27-2017, 06:30 AM
  2. Replies: 1
    Last Post: 06-27-2016, 05:28 PM
  3. Replies: 4
    Last Post: 01-17-2016, 10:25 PM
  4. Replies: 5
    Last Post: 02-20-2014, 11:05 AM
  5. Replies: 5
    Last Post: 05-02-2013, 05:20 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