MS Access Dlookup with text criteria
<p>I use <code>dlookup</code> method to use employeeid as an index to search employeename in my Access form. Below is the code I wrote.  employeeid is a short text in my table. The <code>Dlookup</code> method cannot return a value(always error) unless I change criteria to ID, default primary key, and eliminate '' symbols in my code. </p>

<p>Also I try to change my table property employeeid column as a number, and eliminate ''symbols, the method also cannot return a value. seems like <code>dlookup</code> method can only use default primary key as a criteria in this case. Can anyone help with this? </p>

<pre class="lang-vb prettyprint-override"><code>Public Function GetEmployeeName() As Variant
    GetEmployeeName = DLookup("[EmployeeName]", "EInfor", "[EmployeeID] = "'&amp; Me.txtEID.Value &amp; "'")   
End Function
</code></pre>