Hi, Thanks for taking the time to help!
I'm not sure what I'm doing wrong here. This is my code:
Code:
Private Sub DhrScanTxt_Enter()
Dim Status As String
Debug.Print Me.DhrScanTxt
If (Me.DhrScanTxt.Value = Empty) Then Me.DhrScanTxt.Value = ""
Debug.Print Me.DhrScanTxt
Status = Nz(Me.DhrScanTxt.Value, "Error Null")
Debug.Print Status
Debug.Print Me.DhrScanTxt
Me.Text26 = Status
Dim SoNum As Long
SoNum = CLng(Left(Status, 6))
Me.SoNumTxt = SoNum
Dim DhrNum As Long
DhrNum = Right(Left(Status, 9), 2)
Me.DhrNumTxt = DhrNum
Dim StepNum As Long
StepNum = Right(Status, 3)
Me.StepNumTxt = StepNum
Me.DhrScanTxt.SetFocus
End Sub
Everytime I open the form the field is null so I was trying to replace it with an empty string so I wouldn't get the error "Invalid use of null" but now I get mismatched type.
The rest of the system works but as you can see in SoNum I am trying to take part of a string and convert it to a long but I keep getting type mismatch when I use Nz.
If I do this:
Code:
Dim Status As String
If (Me.DhrScanTxt.Value = Null) Then Me.DhrScanTxt.Value = ""
Status = Me.DhrScanTxt.Value
Me.Text26 = Status
Dim SoNum As Long
SoNum = CLng(Left(Status, 6))
Me.SoNumTxt = SoNum
Then I get invalid use of Null.
I'm not sure what I'm doing wrong.