Solved

OldValue and case-sensitivity

Posted on 2012-04-11
4
261 Views
Last Modified: 2012-04-11
I need to prevent editing of a field after the record has been saved.  The analyst wishes to accomplish this by doing a check when the record is saved, and then display a message.

So, I did this:

 
   If Not frmMe.NewRecord Then
    If (TStr(frmMe!txtTestId.OldValue) <> TStr(frmMe!txtTestId)) Then
        Msg_Err GetStringConst("Test", 280)
        Cancel = True
        GoTo ExitRoutine
    End If
   End If

Open in new window


The problem is, this check does not recognize that the value is different if you simply change the case of the value.

In other words, if txtTestId.OldValue is "DEF", and I change the value of txtTestId to "def", the two values are interpreted as equal, so the message does not display.

How do I make this check case-sensitive?

Thanks!
0
Comment
Question by:L_Malchiodi
4 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 37832962
Checkout the strComp() function in Access Help
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 37832984
here is one quick way
in the top of your Form module, use

Option Compare Binary
0
 
LVL 26

Expert Comment

by:Nick67
ID: 37833015
Go sideways!
Lock that control if you are not on a new record

If Not frmMe.NewRecord Then
    frmMe!txtTestId.locked = true
else
    frmMe!txtTestId.locked = false
end if

Then nobody can change it if you aren't on a new record
0
 

Author Closing Comment

by:L_Malchiodi
ID: 37833042
Thanks, StrComp worked nicely.  I changed the line where the check is done to this:

If StrComp(TStr(frmMe!txtTestId), TStr(frmMe!txtTestId.OldValue), 0) <> 0 Then
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now