Change an O to a 0 on change (1 Viewer)

psyc0tic1

Access Moron
Local time
Yesterday, 21:45
Joined
Jul 10, 2017
Messages
360
I have to let go of starting the new records in my database and my OCD alarm is ringing like crazy.

On my record input form there is a field for putting in a PO number (tbl_auditdata - PONumber) and typically the PO number looks like this: P0FG456. At this time there is always a P for the first character. Also at this time the second character is either a T or a zero and the rest of the characters change constantly. The second character can also change over time but there will never be the letter "O" in the PO number in any position.

I have already put code in the afteupdate event to force capitalization but I do not know how to disallow the letter "O" in this field.

The reason I ask is because through many emails from the database users (who are the ones that will have to create their own new records now), they constantly use the capital O in the PO number when they send me information... so I don't want them to be able to put that in the database to avoid confusion and crappy data.

Please help me with this.
 

psyc0tic1

Access Moron
Local time
Yesterday, 21:45
Joined
Jul 10, 2017
Messages
360

Replace was the trick

Here is the final code that implements the replacing anything with uppercase and replacing an O with a zero:
Code:
Private Sub PONumber_AfterUpdate()
    If Len(Me!PONumber) > 0 Then
        Me!PONumber = UCase(Me!PONumber)
        Me!PONumber = Replace(Me!PONumber, "O", "0")
    End If
End Sub

Thanks for the responses! :D
 

Users who are viewing this thread

Top Bottom