After Update not working quite correct

C

carriey

Hello, awhile ago I got some help here and my code was working great!

Basically the user types in a field (UWI): 100121506109W4. Our IT guys have
written some code on the On Lost Focus that calls some Oracle tables and
determines what a bunch of other fields are (I can't touch that code and they
are too busy to assist me) - one of these fields is the Survey System which I
need.

I then needed the field to be split out into a number of different fields
based on the Survey System. if the Survey System is DLS the fields would be:
LSD, LE, SEC, TWP, RGE, MER as the users need to be able to search on each of
these and sort correctly (which starts with MER, then TWP....) so, thanks to
the newsgroup, I added the following into the After Update:

Private Sub UWI_AfterUpdate()
If Survey_System = "DLS" Then
Me!LE = Left(Me!UWI, 3)
Me!LSD = Mid(Me!UWI, 4, 2)
Me!SEC = Mid(Me!UWI, 6, 2)
Me!TWP = Mid(Me!UWI, 8, 3)
Me!RGE = Mid(Me!UWI, 11, 2)
Me!MER = Mid(Me!UWI, 13, 2)
ElseIf Survey_System = "NTS" Then
Me!NTS_200 = Left(Me!UWI, 3)
Me!NTS_QUnit = Mid(Me!UWI, 4, 1)
Me!NTS_Unit = Mid(Me!UWI, 5, 3)
Me!NTS_4Block = Mid(Me!UWI, 8, 1)
Me!NTS_Map = Mid(Me!UWI, 9, 3)
Me!NTS_6Block = Mid(Me!UWI, 12, 1)
Me!NTS_7Block = Mid(Me!UWI, 13, 2)
End If
End Sub

This worked great until they did an upgrade to the Oracle tables. Since
then, when I tab out of the UWI field, it does not update the various fields.
However, if I return back to the field and delete the last number it then
fills in all the correct fields except the last one (which is empty). Then
if I retype in the last number it fills that in the correct field too and I'm
good to go. Obviously this isn't the best system! Right now I am the only
one entering the data but fairly soon we will have some more users so I need
to fix this!

I have tried putting this code on the After Update event for the Survey
System but that doesn't work at all (I'm wondering if that's because Survey
System fills in automatically based on the On Lost Focus event?).

Any advice is appreciated as always!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top