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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Before update 2115 error on an unbound textbox

Status
Not open for further replies.

ep1

Programmer
Oct 22, 2003
8
US
Code:

Private Sub txt_start_BeforeUpdate(Cancel As Integer)

Dim strtext As String


strtext = Me.txt_start.Value & " "

If Len(strtext) = 1 Then
Me.txt_start.Value = "01/01/2006"
End If

End Sub

I have a scenario where a user erases the prepopulated date of today (using a format on Date). The form is unbound so not hooked to a table definition so I do not believe zero length strings are involved. The field once populated will go into SQL to do a Select query.

The problem is I cannot place the date text into a null value because I keep getting a 2115 runtime error. I think it may be theoretically impossible but I have not given up yet.

I have gone through the archives and found 13 hits. One person had the same issue but the thread was never answered.

Any help would be appreciated.

Thanks,

EP1
 
Are you trying to convert possible nulls to a string with that code? If so, try this
Code:
Me.txt_start.Value = NZ(Me.txt_start.Value, "01/01/2006")
 
Golom thank you for your attempt but that still results in:

Run-time error '2115':

"the macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Microsoft Acess from saving the data in the field."

There are no Validation rule(s) or text with this unbound textbox.

Thanks,

EP1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top