locked
OldValue property RRS feed

  • Question

  • Is there any type of input control that the OldValue property cannot be used? with. I'm getting an error in an IF statement that checks the OldValue property of every control on a form. One control is a Checkbox, can it be used on that?
    Wednesday, March 22, 2017 10:13 PM

Answers

  • Never mind, I found I had one of the fields named wrongly. I was using the Control Source name instead of the Control Name. They were the same for every control except this one.
    Wednesday, March 22, 2017 10:44 PM

All replies

  • Hi,

    A checkbox has an OldValue property, so it's probably not the problem. What error message were you receiving?

    Wednesday, March 22, 2017 10:27 PM
  • Error message is: Object doesn't support this property or method

    Here is the statement:

       ' Bypass checks if nothing has changed
       If Nz(Me!DoctorLastName, "") = Nz(Me!DoctorLastName.OldValue, "") And _
          Nz(Me![ProviderDoctorFirs Name], "") = Nz(Me![ProviderDoctorFirs Name].OldValue, "") And _
          Nz(Me!MI, "") = Nz(Me!MI.OldValue, "") And _
          Nz(Me!ProviderID, "") = Nz(Me!ProviderID.OldValue, "") And _
          Nz(Me!TaxIDNumber, "") = Nz(Me!TaxIDNumber.OldValue, "") And _
          Nz(Me!OIGCaseNo, "") = Nz(Me!OIGCaseNo.OldValue, "") And _
          Nz(Me![F-DateLogged], "") = Nz(Me![F-DateLogged].OldValue, "") And _
          Nz(Me!CheckNumber, "") = Nz(Me!CheckNumber.OldValue, "") And _
          Nz(Me!SentTo, "") = Nz(Me!SentTo.OldValue, "") And _
          Nz(Me![F_DateReceived], "") = Nz(Me![F_DateReceived].OldValue, "") And _
          Nz(Me!CheckDate, "") = Nz(Me!CheckDate.OldValue, "") And _
          Nz(Me!DateSentbyResearch, "") = Nz(Me!DateSentbyResearch.OldValue, "") And _
          Nz(Me!Amount, "") = Nz(Me!Amount.OldValue, "") And _
          Nz(Me!RefundDocId, "") = Nz(Me!RefundDocId.OldValue, "") And _
          Nz(Me!TypeOfActionID, "") = Nz(Me!TypeOfActionID.OldValue, "") And _
          Nz(Me!DepositNumber, "") = Nz(Me!DepositNumber.OldValue, "") And _
          Nz(Me!OffsetDocId, "") = Nz(Me!OffsetDocId.OldValue, "") And _
          Nz(Me!Program, "") = Nz(Me!Program.OldValue, "") And _
          Nz(Me!DepositDate, "") = Nz(Me!DepositDate.OldValue, "") And _
          Nz(Me!PrintDeposit, "") = Nz(Me!PrintDeposit.OldValue, "") And _
          Nz(Me!FinanceNotes, "") = Nz(Me!FinanceNotes.OldValue, "") And _
          Nz(Me!CheckStatus, "") = Nz(Me!CheckStatus.OldValue, "") And _
          Nz(Me!ReferType, "") = Nz(Me!ReferType.OldValue, "") And _
          Nz(Me!DateClosed, "") = Nz(Me!DateClosed.OldValue, "") Then
          GoTo EX
       End If

    Wednesday, March 22, 2017 10:29 PM
  • Never mind, I found I had one of the fields named wrongly. I was using the Control Source name instead of the Control Name. They were the same for every control except this one.
    Wednesday, March 22, 2017 10:44 PM
  • Hi, Congratulations! Glad to hear you got it sorted out. Cheers.
    Wednesday, March 22, 2017 11:07 PM
  • Just curious, which event are you using for the above code?
    Wednesday, March 22, 2017 11:09 PM
  • BeforeUpdate event
    Wednesday, March 22, 2017 11:37 PM
  • Okay, it makes sense but what check are you trying to bypass? Do you have all the controls on your form listed in the above code? If so, then the event won't even fire if the user did not change anything. Are you doing other things in the code we're not seeing?
    Wednesday, March 22, 2017 11:48 PM
  • Well this is a database that I did not create and the table structures leave a lot to be desired. They have several distinct types of data (that should really be in different tables) crammed into one table. Then they have a bound form with a tab control with three tabs for three different types of data. I have to perform validations for each tab to validate certain required fields. These validations require me to know if anything changed on the tab. If nothing changed on the tab, I don't do the validations for that tab. That is why I am running a series of value/oldvalue checks for the data on each tab. I can't use the 'dirty' attribute as that applies to the whole form.



    Wednesday, March 29, 2017 6:13 PM