Solved

Error in VB code Run-time error '2115'

Posted on 2002-05-21
8
487 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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
 
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server views 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 Access…
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 …

786 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