MS Access: passing parameters from one access form to another

后端 未结 4 1600
感情败类
感情败类 2021-01-13 19:12

I\'ve got a form and a button on it. I would like to open another form on a button click with a parameter passed from the parent form to the child form (child form\'s Record

4条回答
  •  囚心锁ツ
    2021-01-13 19:39

    You can refer to any property of the calling form by reference to the form's object. I will not use the ! notation for form's properties (I hate it). so if you want to inherit:

    a form's control value:

    forms(parentFormName).controls(controlName).value 
    

    a form's recordset field value:

    forms(parentFormName).recordset.fields(fieldName).value
    

    The recordset turnaround is particularly useful when accessing id's (guid) values. You cannot read these values through form's controls, but you can access them throught the corresponding field in the recordset. If you have a combobox on a form containing a guid field, please compare the following:

     screen.activeForm.controls(myComboControlName).value
    

    and

     screen.activeForm.recordset.fields(myComboControlName).value
    

提交回复
热议问题