Results 1 to 4 of 4
  1. #1
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451

    default value in subform

    Thank you all for any help. I'm learning access and need help. I have a form with a subform in it. A few of the values are the same on the subform as on the form and I would like to enter these values on the form and have them also appear in the appropriate boxes on the subform. Can someone please guide me?

  2. #2
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,173
    Hi,

    if you have some default values in the main table that can be overwritten in the details table (assuming this is the situation), you can add some code in the OnCurrent event of the main form that sets the default values from the subform to the value of the corresponding fields in the main form.
    The code could look like:

    Private Sub Form_Current()
    Me.sfrmMySubForm.Form.txtMyTextBox.DefaultValue = Me.txtMainTextBox
    End Sub

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    If the value exists in the master form, There is no need to re-enter them again in the sub form.
    by the nature of the 1- many table if the master has it, so does all children.
    you would be duplicating data. Is this what you need?

  4. #4
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    Thanks for the replies but I could not get it to work. A little more clarification would be, main form vicsmainF text box "gauge" would have an input value that is saved then subform vicsprodution text box "gauge" would copy that value. I'm still trying to learn and figure out this coding. If anyone noes a good book or better way to learn please let me know.

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

Similar Threads

  1. Subform in continuous default view
    By gykiang in forum Forms
    Replies: 2
    Last Post: 03-29-2015, 12:22 PM
  2. Subform ComboBox Default Value
    By djrolla in forum Forms
    Replies: 9
    Last Post: 06-24-2014, 12:22 AM
  3. Default Subform Value
    By clto0501 in forum Forms
    Replies: 5
    Last Post: 04-09-2014, 01:01 PM
  4. some row as default in subform..
    By alex_raju in forum Access
    Replies: 4
    Last Post: 07-20-2011, 08:20 AM
  5. row default in subform.
    By alex_raju in forum Access
    Replies: 0
    Last Post: 07-07-2011, 02:05 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