Private Sub cmdjoblocate_Click()
'Dim mydb As Database, MYTABLE As DAO.Recordset
Dim MYTABLE As DAO.Recordset
Dim sJob As String, sLoc As String
Set mydb = CurrentDb
Set mydb = DBEngine.Workspaces(0).Databases(0)
Set MYTABLE = mydb.OpenRecordset("3year", DB_OPEN_TABLE)
MYTABLE.Index = "Job Number"
MYTABLE.Index = "Location Text"
sJob = InputBox("What Job Number do you want to find?", _
"JOB LOCATER")
If IsNull(sJob) Then
MsgBox "Please enter a Job Number"
Exit Sub
Else
sLoc = DLookup("Location Text", _
"MYTABLE", "Job Number =" + sJob + "'")
'sLoc = DLookup("Location Text", _
'"MYTABLE", "Job Number = " & sJob)
End If
MsgBox ("Job Number: " & sJob & _
" WAS FOUND! " & vbCrLf & _
"and is located in: " & sLoc & ".")
End Sub