Results 1 to 14 of 14
  1. #1
    jazzy is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    77

    giving a bound control a default value


    I have a form frm_Contracts (Record Source is tbl_Contracts) with a field NameonContract. I open another form frm_eSignature (Record Source is also tbl_Contracts) which has a field eSignNameonContract.
    I Want to give frm_eSignature field eSignNameonContract (bound control) the default value of frm_Contracts.NameonContract.

    i can do this with a command button with VBA but was hoping to do it without adding another step to the users

    Thanks

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I open another form frm_eSignature (Record Source is also tbl_Contracts)
    How?
    If from a button on formA you can pass the value of a formA field to the OpenArgs property for the opening form. Seems that you don't want to do that though.
    Or you can open formB in any manner and get a field value from formA if it is still open. As long as the target control is not using an expression as its controlsource you should be ok.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    jazzy is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    77
    Quote Originally Posted by Micron View Post
    How?
    Or you can open formB in any manner and get a field value from formA if it is still open. As long as the target control is not using an expression as its controlsource you should be ok.
    You would think, but it doesnt. formA is still open and has field NameOnContract. formB has field eSignNameOnContract which has ControlSource -eSignNameOnContract. Default Value for eSignNameOnContract is =[Forms]![frm_Contract]![NameonContract]. which doesnt prdouce the value. if i put a command button on FormB and do
    Code:
    If IsNull(Me.eSignNameonContract) Then
    Me.eSignNameonContract = Form_frm_Contract.NameonContract
    End If
    it will populate.

  4. #4
    jazzy is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    77
    figured it out...data entry on FromB was set to NO. Thanks Micron

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Glad to see that you solved it!
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    jazzy is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    77
    still not right. its creating a new record now. going to make a sample database and upload

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Data entry = yes, means you can only ADD records?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #8
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    From your latest post I think what you want is simply in the open event of form B (hopefully you open it from form A with the appropriate Where clause in the Docmd.OpenForm method as to open the right record):

    Code:
    Me.eSignNameonContract = Form_frm_Contract.NameonContract
    You could also pass the NameOnContact value from form A to form B as the OpenArgs parameter of the Docmd.OpenForm and in the Open event of form B to have:
    Code:
    Me.eSignNameonContract = Me.OpenArgs
    Set form B to Data Entry=No and remove the default value from the eSign... field (default values only apply to new records as you found out).

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  9. #9
    jazzy is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    77
    this is on Form Open of Form B

    Code:
    Private Sub Form_Open(Cancel As Integer)
    Me.eSignNameonContract = Form_frm_Contract.NameonContract
    End Sub
    gives me an object required error. FYI, both forms bound to same table

  10. #10
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Does your frm_Contract has any VBA?
    Usually you'd use:
    Code:
    Me.eSignNameonContract = Forms!frm_Contract!NameonContract 'assumes the textbox bound to NameonContact has the same name as the field
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  11. #11
    jazzy is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    77
    Code:
    Private Sub Form_Open(Cancel As Integer)
    Me.eSignNameonContract = Forms!Form_frm_Contract!NameonContract
    End Sub
    Microsoft Access cannot find the referenced form 'Form_frm_Contract'

    Here is a quick copy of my issue
    Test for eSign Issue and Override.zip

  12. #12
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    It is just frm_Contract. But just realized that you do not need to reference that form at all as the source field is already on the eSignature form. Have a look at the updated sample.

    Cheers,
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  13. #13
    jazzy is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    77
    Vlad, as usual you da man. worked perfectly.

  14. #14
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Bound Object Frame default
    By Kalmed2018 in forum Access
    Replies: 4
    Last Post: 11-19-2018, 10:23 PM
  2. Replies: 23
    Last Post: 01-27-2016, 01:42 PM
  3. Control source Expression giving #Error
    By N3w2access in forum Forms
    Replies: 5
    Last Post: 01-21-2014, 07:53 AM
  4. Replies: 8
    Last Post: 09-19-2013, 03:07 PM
  5. Replies: 2
    Last Post: 07-30-2009, 08:02 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