Results 1 to 14 of 14
  1. #1
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Requery error Message (2000)

    Hi,
    I have a main form with 4 subforms. The first subform is sfrmRecSourceSubform. This is the subform that has the On current event below. I'm getting the following error message: Run-time error '-2147417848(80010108)': Method 'Requery' of object '_Subform' failed. When I click on debug it takes me to the following:
    Private Sub Form_Current()
    Me.Parent.sfrmComponentPartsForQuoteFormSubform.Re query
    Me.Parent.sfrmComponentPartsVendorSubform.Requery
    Me.Parent.sfrmQuotesSubform.Requery
    End Sub
    With the first line highlighted which is a subform. I have checked spelling. The form worked at one time, but not sure what I changed and now it won't work. The error does not occur when I first open the form only when I go to another record in the main form. I have no idea why I'm getting this. Anyone have any ideas
    Thanks,
    Deb

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Requery error Message (2000)

    Use

    Me.Parent.sfrmComponentPartsForQuoteFormSubform<big>.Form</big>.Requery

    and similar for the others, to indicate that you are refreshing the form within the subform control.

  3. #3
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Requery error Message (2000)

    Hans,
    I added the extra Form that you suggested and now when I open the form I get the following error: Run-time error '2455': You entered and expression that has an invalid reference to the property Form/Report. I click end and it does take me to the form so I try and go to another record and I get this error: Run-time error '#same as my first post' Method requery of object '_Form_sfrmComponentPartsforQuoteFormSubform' failed. I click debug and it takes me to the same line as my first post. Any thoughts?
    Thanks,
    Deb

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Requery error Message (2000)

    That's puzzling. Are sfrmComponentPartsforQuoteFormSubform etc. the names of the subforms as controls on the main form? You should use the control names, they might be different from the names of the subforms in the database window.

  5. #5
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Requery error Message (2000)

    As far as I know they are the names of the controls, I get confused with that, I would go into the properties of the subform and Name property is the control name right? if that's true then yes, they are the control names. I do have the first 2 subforms on a tab control. Forgot to mention that until just now. Does that make a difference?
    Thanks,
    Deb

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Requery error Message (2000)

    Tab controls are irrelevant here, they are just a way of organizing controls. There might be some kind of timing problem - the exact order in which events for main and subforms occur is hard to control. Without knowing more about the forms it is impossible for me to know what is going on.

  7. #7
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Requery error Message (2000)

    I didn't think they did that's why I didn't mention it earlier but figured I should just in case. So when you said something about order, I moved the last subform statement in my code first and now I don't get any error messages when I open the form or when I move from one record to another and the subform requeries correctly, EXCEPT, when I click on the GoToFirstRecord button I get that first error message. But after playing with the order, it seems to work. I'm doing more testing now.
    Thanks,
    Deb

  8. #8
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Requery error Message (2000)

    Well, I did some testing and I have the following code:
    Private Sub Form_Current()
    Me.Parent.sfrmQuotesSubform.Requery
    Me.Parent.sfrmComponentPartsForQuoteFormSubform.Re query
    Me.Parent.sfrmComponentPartsVendorSubform.Requery
    End Sub

    It works when I go to a another record and go back but if I use the "gotofirstrecord" button i get the first error I posted and it highligts Me.Parent.sfrmComponentPartsForQuoteFormSubform.Re query. If I switch that around and make it last then it hightlights the Me.Parent.sfrmComponentPartsVendorSubform.Requery. Why would it bomb out on when using that first button?

    thanks,
    Deb

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Requery error Message (2000)

    Sorry, that's impossible to say without knowing more about the main and subforms.

  10. #10
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Requery error Message (2000)

    Here's a scaled version. It's frmQuoteParts. Thanks, Deb
    Attached Files Attached Files

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Requery error Message (2000)

    See if the attached version does what you want. I have placed an invisible text box named lngRecSourceID on the main form, with control source =sfrmRecSourceSubform!lngRecSourceID. I then changed the link master field for the other three subforms from sfrmRecSourceSubform!lngRecSourceID to lngRecSourceID, and removed the On Current event procedure for sfrmRecSourceSubform. The new text box updates automatically, so there is no need to requery the subforms.
    Attached Files Attached Files

  12. #12
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Requery error Message (2000)

    Hans,
    That seemed to do the trick. I'm going to do further testing but so far so good. Thank you once again and have a Happy 4th!
    Deb

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Requery error Message (2000)

    Thanks, and the same to you! (The 4th of July is not a special date in The Netherlands, but I appreciate the sentiment.)

  14. #14
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Requery error Message (2000)

    Ya know I was going to ask where you were from. I had a feeling not the US. Well I'll tip a few for you!! My boss's are impressed with this database and I have you to partly thank for it! Thanks.
    Deb

Posting Permissions

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