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

Access 2000. Error '2113' when set CheckBox to the CheckBox.OldValue

Status
Not open for further replies.

andreymurom

Programmer
May 18, 2001
10
0
0
US
I had this code in Before_Update procedure:

If .....
Me![chkXXX] = Me![chkXXX].OldValue
End If

If I try to enter a new record and don't touch this check Box and then move to another record, I am getting "Run-time Error '2113'. The value you entered isn't valid for this field".

I could work around this problem by changing the code to:

If .....
If Me![chkXXX].OldValue = True Then
Me![chkXXX] = True
Else
Me![chkXXX] = False
End If
End If

So it looks like something is wrong with the data type or data format that .OldValue returns.

I looked at the help and OldValue is of variant data type and returns the same data type that it is getting, including Boolean. I tried to change data format in the table field that populates that check box from Yes/No to True/False but result is the same.

Can anybody suggest me what is going on and what the proper way to fix the problem would be?

Thank you very much,

Andre
 
Your table is looking for 0 for false and -1 for true so if the OldValue is Null you have to convert it:

If ...
Me![chk1] = Nz(Me![chk2].OldValue, 0)
End If


Later,

VBSlammer
redinvader3walking.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top