locked
getting error message RRS feed

  • Question

  • Hello.  I have a form with a tab control on it.  The tab control has 8 tabs on it.  Only the Parts tab is a subform, all other tabs are part of the main form recordsource.  On the tab called Signoff, if a person tries to go to another record they receive an expression error message, "You entered an expression that has an invalid reference to the property Form/Report."  This message comes up only the first time a person tries to move to another record from the Signoff tab.  After clicking the OK button, the person can move between records without incident.  I was able to finally track it down to the Else part of the code below.  This is in the Form_Current event of the main form.  The zECOPartsPer is the subform control on the Parts tab.  The recordsource is a sql server view.  The subform's recordsource is listed as the same.  I removed the recordsource from the subform thinking that was causing the issue but it was not

    Does anyone have any thoughts or ideas as to what would be causing this error message?

    Thanks....John


      If ECO = 0 Then
        zECOPartsPer.Form.RecordSource = "SELECT * FROM [ECOPartsPerQ] WHERE Obsolete = False"
      Else
        zECOPartsPer.Form.RecordSource = "ECOPartsPerQ"
      End If

    Friday, September 16, 2011 2:18 PM

Answers

  • Tried that as well.  Nothing.  It compiles without issue.  But yet when moving to a new record only from the Signoff tab that message appears.   I've even gone over all the controls on the tab and there is nothing out of the ordinary.  I also found out that it has been there for a long time but no user has ever mentioned it.  They click OK and move on.  So, I'm not going to worry about it for now.   Word is this A2007 app is one that is being replaced with a new state of the art application.
    • Proposed as answer by Bruce Song Wednesday, September 21, 2011 7:55 AM
    • Marked as answer by Bruce Song Thursday, September 29, 2011 9:53 AM
    Friday, September 16, 2011 4:28 PM

All replies

  • Try:

      If ECO = 0 Then
        zECOPartsPer.Form.RecordSource = "SELECT * FROM [ECOPartsPerQ] WHERE Obsolete = False"
      Else
        zECOPartsPer.Form.RecordSource = "SELECT * FROM ECOPartsPerQ"
      End IfReport As Abuse

     

    Peter


    Groeten, Peter http://access.xps350.com/
    Friday, September 16, 2011 3:01 PM
  • Tried that but no difference.  Still get the message.
    Friday, September 16, 2011 3:06 PM
  • First off, you should use

    ME

    when referring to items on the form when the code is referring to something on the form which the code is on.  It helps Access know exactly what you are talking about when sometimes it gets confused.

     Like

     

    Me.zECOPartsPer.Form.RecordSource = "SELECT * FROM ECOPartsPerQ"

    Second, you must be using the name of the Subform CONTROL (control on the parent form which HOUSES the subform) and not the name of the subform itself, unless both use exactly the same name.


    Bob Larson, Access MVP 2008-2010, 2011
    • Edited by accessbob-pdx Friday, September 16, 2011 3:34 PM add additional information
    Friday, September 16, 2011 3:33 PM
  • Tried ME before posting and that did not work either.  I also verified that control name, it is zECOPartsPer.  I commented out the line that it points back to and the message popped up in a different area.  But only from the Signoff tab.  This is what's baffling.  The same code runs when moving to a new record when on any of the tabs.

    Friday, September 16, 2011 3:39 PM
  • First off - do some debugging.  Go to the VBA Window, and go to DEBUG > COMPILE and when it takes you to an error - fix it.  There may be more errors than you realize which are contributing to the problem.  Get it to a point where no errors come up when you compile and then if the error happens it will most likely take you to the right spot.  Sometimes, it won't if you have compile errors.
    Bob Larson, Access MVP 2008-2010, 2011
    Friday, September 16, 2011 3:42 PM
  • Tried that as well.  Nothing.  It compiles without issue.  But yet when moving to a new record only from the Signoff tab that message appears.   I've even gone over all the controls on the tab and there is nothing out of the ordinary.  I also found out that it has been there for a long time but no user has ever mentioned it.  They click OK and move on.  So, I'm not going to worry about it for now.   Word is this A2007 app is one that is being replaced with a new state of the art application.
    • Proposed as answer by Bruce Song Wednesday, September 21, 2011 7:55 AM
    • Marked as answer by Bruce Song Thursday, September 29, 2011 9:53 AM
    Friday, September 16, 2011 4:28 PM