Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Posts
    35

    Unanswered: Problem referring to subform2

    I've hit a blind spot, not been using VBA for quite a few years.

    I have a form on which are two subforms. In the AfterUpdate event of a combobox on subform1 I am trying to filter the records displayed on subform2 and I keep getting "Access cannot find the field 'frmCompleteData'". frmCompleteData is subform2.

    To test this I have put an extra textbox 'Text43' on subform2 (frmCompleteData) but I still get the same error when using either of these:
    Me!frmCompleteData.Form.Text43.Value = "abcdefghi"
    Form("frmCompleteData").Form![Text43].Value = "abcdef"

    I have tried both the period and exclamation mark before Text43 but it doesn't make a difference. Since it's been so long since I've used VBA, I suspect it's pretty obvious where I'm going wrong.

    Thanks

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    me. refers to the current wahtever. so if you are using it in a sub form then the form its referrign to has to be a form within that subform
    you could try
    forms!frmCompleteData.text43

    or failing that you may have to force code to run in the parent form which has visibility of the other sub form. you should be able to do that throuigh a sub or function in the parent form
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Nov 2004
    Posts
    35
    Thanks for your reply. That gives me "Access cannot find the referenced form frmCompleteData" but at least it knows it's looking for a form so I'm a step further on The form name is correct as I can debug.print each object in the current project and this form name is listed.
    Would this have anything to do with subform2 being a continuous form?

    Thanks

    PS Forget to mention that I had previously tried variations of Me.Parent etc

Posting Permissions

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