Using Access 2007
Getting a datatype mismatch error when using dlookup in a procedure but everything looks correct. Second set of eyes please.
Table = BuyerDepartment
Fields = Dept Text(4), Dept_CD Text(3), Analyst_Tables_Path Text(255)
Values = Dept - 912A, Dept_CD - 912, Analyst_Tables_Path = \\tsavm45\ATIDev$\Business Analysis\DataSource\AnalystTables-Footwear.mdb
<code>
Dim DeptList As ADODB.Recordset ' Create recordset variable for Buyer departments
Dim strPathA As String ' The path to Analyst databases. This is assigned in loop based on dept.
Dim DeptStr As String ' The 4 char Dept number including A, B, C
Dim DeptCDStr As String ' The 3 char Dept number
DeptList.Open "Select Dept, Dept_CD from BuyerDepartment order by Dept asc", CurrentProject.Connection, adOpenForwardOnly
DeptList.MoveFirst
dbcount = 0
Do While Not DeptList.EOF
'Assign Dept value
DeptStr = DeptList.Fields("Dept").Value
DeptCDStr = DeptList.Fields("Dept_CD").Value
'Get Analyst
strPathA = DLookup("Analyst_Tables_Path", "BuyerDepartment", "Dept =" & DeptStr)
<code>
strPathA giving me a datatype mismatch error but I don't see the problem.