Solved

Error in VB code Run-time error '2115'

Posted on 2002-05-21
8
492 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

705 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