Solved

Error in VB code Run-time error '2115'

Posted on 2002-05-21
8
484 Views
Last Modified: 2010-05-18
I keep getting this error
Run-Time error '2115'
The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing PO System from saving the data in the field.

My Code...
Private Sub Frame0_AfterUpdate()
If Frame0.Value = 1 Then
  txtStartRange.SetFocus
  txtStartRange.Text = Date - Weekday(Now(), 2) - 1
  txtStopRange.SetFocus
  txtStopRange.Text = Date - Weekday(Now(), 2) + 6
ElseIf Frame0.Value = 2 Then
  txtStartRange.SetFocus
  txtStartRange.Text = Date - Weekday(Now(), 2) - 7
  txtStopRange.SetFocus
  txtStopRange.Text = Date - Weekday(Now(), 2) - 1
End If
End Sub


0
Comment
Question by:Tom_Hickerson
  • 6
  • 2
8 Comments
 
LVL 2

Expert Comment

by:mjasic
ID: 7024667
What do you have as ControlSOurce property in your txtStartRange and txtStopRange? Is there any kind of call like: =MyFunction() ?
Do you have anything in txtStartRange_BeforeUpdate or txtStopRange_BeforeUpdate procedures?


0
 
LVL 1

Author Comment

by:Tom_Hickerson
ID: 7024795
Nothing in the controlsource.  No event procedures on the text boxes either.  
0
 
LVL 2

Expert Comment

by:mjasic
ID: 7024796
What do you have as ControlSOurce property in your txtStartRange and txtStopRange? Is there any kind of call like: =MyFunction() ?
Do you have anything in txtStartRange_BeforeUpdate or txtStopRange_BeforeUpdate procedures?


0
 
LVL 2

Accepted Solution

by:
mjasic earned 50 total points
ID: 7024826
Just change your code as follows:


Private Sub Frame0_AfterUpdate()
If Frame0.Value = 1 Then
 txtStartRange.SetFocus
 txtStartRange.Value = Date - Weekday(Now(), 2) - 1
 txtStopRange.SetFocus
 txtStopRange.Value = Date - Weekday(Now(), 2) + 6
ElseIf Frame0.Value = 2 Then
 txtStartRange.SetFocus
 txtStartRange.Value = Date - Weekday(Now(), 2) - 7
 txtStopRange.SetFocus
 txtStopRange.Value = Date - Weekday(Now(), 2) - 1
End If
End Sub
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 2

Expert Comment

by:mjasic
ID: 7024828
As you see, the only thing to change was .Text to .Value.

Michel
0
 
LVL 2

Expert Comment

by:mjasic
ID: 7024837
What do you have as ControlSOurce property in your txtStartRange and txtStopRange? Is there any kind of call like: =MyFunction() ?
Do you have anything in txtStartRange_BeforeUpdate or txtStopRange_BeforeUpdate procedures?


0
 
LVL 1

Author Comment

by:Tom_Hickerson
ID: 7025077
Thanks.  I guess my VB experience doesn't always apply!
0
 
LVL 2

Expert Comment

by:mjasic
ID: 7025290
What do you have as ControlSOurce property in your txtStartRange and txtStopRange? Is there any kind of call like: =MyFunction() ?
Do you have anything in txtStartRange_BeforeUpdate or txtStopRange_BeforeUpdate procedures?


0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now