[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Error in VB code Run-time error '2115'

Posted on 2002-05-21
8
Medium Priority
?
495 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Accepted Solution

by:
mjasic earned 200 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
 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

834 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