Solved

Error in VB code Run-time error '2115'

Posted on 2002-05-21
8
490 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
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 …

820 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