Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2002
    Location
    Melbourne
    Posts
    92

    Unanswered: mainform value to a subform

    anyone know how to copy a value from a main form to a record in a subform.? eg if SSN in main form is 444-444-444 then this value gets copied in the subform each time a new record is created in the subform.

  2. #2
    Join Date
    Jan 2003
    Location
    Vietnam
    Posts
    188

    Re: mainform value to a subform

    Originally posted by billjov
    anyone know how to copy a value from a main form to a record in a subform.? eg if SSN in main form is 444-444-444 then this value gets copied in the subform each time a new record is created in the subform.
    i guest the field SSN is the linked field between your main and sub form. if thats the case, i would write some vb codes in the sub form before_insert event. something likes this:

    Private Sub Form_BeforeInsert(Cancel as Integer)
    Me.SSN1 = Forms("Main_form_name").SSN
    End Sub

    where SSN is the control name in main form containing 444-444-444 and SSN1 is the control name in the subform

    hope this helps
    qha_vn

  3. #3
    Join Date
    Nov 2002
    Location
    Melbourne
    Posts
    92

    Re: mainform value to a subform

    Good morning!

    Thanks qha

    I found another way also. I set the sunform SSN field control as the control source and then set the default value to copy the value from main form to the subform by inserting =[Forms]![frmMain]![SSN].

    This achieved the same thing as your suggestion.

    Thanks!

    Stay in touch.
    PM me if u would like my email address.

    Originally posted by qha_vn
    i guest the field SSN is the linked field between your main and sub form. if thats the case, i would write some vb codes in the sub form before_insert event. something likes this:

    Private Sub Form_BeforeInsert(Cancel as Integer)
    Me.SSN1 = Forms("Main_form_name").SSN
    End Sub

    where SSN is the control name in main form containing 444-444-444 and SSN1 is the control name in the subform

    hope this helps

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •