Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

runtime error 2115

Status
Not open for further replies.

Shift838

IS-IT--Management
Joined
Jan 27, 2003
Messages
987
Location
US
I have an access database that I have various check boxes and text boxes on. I want to be able to use the AfterUpdate event when a checkbox is checked to assign text data to a text box. Both are linked to the database of course. When I code it and try to perform the function I get the Run-Time Error 2115, which states the macro or validation rule is not allowing the databaes to be updated. I have no macro or validation rule. My code is below..

Private Sub chkdti_AfterUpdate()
If chkdti.Value Then
Me.txtenvdti.SetFocus
Me.txtenvdti.Text = "X"
Me.chkdti.SetFocus
Else
Me.txtenvdti.SetFocus
Me.txtenvdti.Text = ""
Me.chkdti.SetFocus
End If
End Sub

 
Does the field definition for envdti allow zero length strings?
 
Hi

line

Me.txtenvdti.Text = ""

perhaps it is set to allow zero length no

try (as a check)

Me.txtenvdti.Text = " "


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
yes, it's set to allow zero length strings.
 
Hi!

What line is giving you the error?

A couple of things to note, instead of the .SetFocus and .Text use the .Value:

Private Sub chkdti_AfterUpdate()
If chkdti.Value Then
Me.txtenvdti.Value = "X"
Else
Me.txtenvdti.Value = ""
End If
End Sub

Your field in the table that txtenvdti is linked to may be set to not allow zero length strings. You can check this in the design view of the table. If it is set to no, then you can change the value to Yes. Alternatively you can use:

Me.txtenvdti.Value = Null

instead of:

Me.txtenvdti.Value = ""

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Bingo! thank you! using the .value instead of .text worked like a charm..

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top