Solved

OldValue and case-sensitivity

Posted on 2012-04-11
4
267 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 48

Accepted Solution

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

Expert Comment

by:Rey Obrero (Capricorn1)
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

635 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