You need to concatenate the of the control STO1Name VALUE to the SQL Where clause.
Code:
Private Sub STOName1_Exit(Cancel As Integer)
Dim rs As DAO.Recordset
Dim strSQL As String
' Dim qdf As DAO.QueryDef
If Me.STO1Name <> "" Then
If Me.Dirty Then
Me.Dirty = False
End If
strSQL = "SELECT STOName, DeploymentResource1, DeploymentResource2, DeploymentResource3, DeploymentResource4"
strSQL = strSQL & " FROM tblSTOs"
strSQL = strSQL & " WHERE STOName = '" & Me.STO1Name & "';"
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
If rs!DeploymentResource1 <> "" Then
Me.STO1Res1Name = rs!DeploymentResource1
If rs!DeploymentResource2 <> "" Then
Me.STO1Res2Name = rs!DeploymentResource2
If rs!DeploymentResource3 <> "" Then
Me.STO1Res3Name = rs!DeploymentResource3
If rs!DeploymentResource1 <> "" Then
Me.STO1Res4Name = rs!DeploymentResource4
End If
End If
End If
End If
End If
rs.Close
Set rs = Nothing
End Sub