Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228

    Check textbox's old value.

    This is the Code I'm using:

    Code:
    Private Sub Scheduled_Start_AfterUpdate()
    If Len(Me.Scheduled_Start.Value & "") = 0 Then
    Exit Sub
    End If
    
    RunCommand acCmdSaveRecord
    DoCmd.OpenForm "auditT"
    End Sub
    But for my purposes this is no good, I need it to check the old value.

    If the text box is blank when the form opens, then I don't need to open the Audit form to give reasoning for a change.

    How do I check the old value of a textbox? I tried old.me.... I get an error doing that, and I cant see anything on google that relates to this. Its possible I'm not looking for the right thing though.



    Any help on this is appreciated.

    *All other aspects of this process are working fine. All relationships are fine. The auditing process is fine. My business rules are fine. Scheduled Start is a date value which indicates a time when work will start. The Audit form is basically an input box on a form. It shows the old date for the scheduled start, the new date, and "todays" date to show when the change occurred. The only use of this form is so we can track these changes and where possible eliminate them in future.

    If anyone would like other information feel free to ask.

  2. #2
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    if checking the old value of a textbox isn't easy/a good idea.. Another way could be to check that value at table level. The table associated with "Scheduled_Start" is named Workdays.

    scheduled_start is the name of the textbox and also the field in the table.

    If anyone could stop this form opening when its a new date that would be awesome.

  3. #3
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Anyone else having the same problem this is how its fixed. (as always I find something new when I decide to make a post about it).

    Code:
    Private Sub Scheduled_Start_AfterUpdate()
    If Len(Me.Scheduled_Start.OldValue & "") = 0 Then
    Exit Sub
    End If
    
    RunCommand acCmdSaveRecord
    DoCmd.OpenForm "auditT"
    End Sub
    I was putting old in the wrong place with my previous attempts.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 33
    Last Post: 09-16-2014, 12:47 PM
  2. Replies: 3
    Last Post: 05-22-2014, 10:19 AM
  3. Replies: 4
    Last Post: 02-28-2013, 10:43 AM
  4. Replies: 3
    Last Post: 01-09-2013, 10:13 AM
  5. Replies: 1
    Last Post: 06-01-2009, 04:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums