try the following:


Data3.RecordSource = "SELECT Codename FROM CodeMstr where NameofField = '" & sName & "'"