I need help. I'm using Access 2007 at my work.
I keep getting the Run-time error 3464: Data type mistmatch in criteria expression. This was working fine and then all of the sudden it wasn't.
I've made some adjustments to my original code but I'm still getting the error.
Please help, this is very frustrating!
Private Sub Loan__AfterUpdate()
Me.Refresh
Dim GetInfoCriteria As String
GetInfoCriteria = "[ACCOUNT_NUMBER] = '" & Screen.ActiveForm.Recordset.Fields("Loan#").Value & "'"
Debug.Print GetInfoCriteria
[Loan#] = DLookup("[ACCOUNT_NUMBER]", "tbl_GetInfo", GetInfoCriteria)
EDIT
Here is my old code that worked for a while:
[Loan#] = DLookup("[ACCOUNT_NUMBER]", "tbl_GetInfo", "[ACCOUNT_NUMBER] = '" & Screen.ActiveForm.Recordset.Fields("Loan#").Value & "'")
I have two table, tbl_GetInfo and tbl_CE. tbl_CE is populated by the user working with a form frm_CE. When the user enters the loan # into frm_CE, I want it to use Dlookup to get this and other information from tbl_GetInfo and put that into tbl_CE. I chose this one field as an example but there are others that it will populate in the same Sub, this is the full example
Dim GetInfoCriteria As String
GetInfoCriteria = "[ACCOUNT_NUMBER] = '" & Screen.ActiveForm.Recordset.Fields("SLSLoan#").Value & "'"
Debug.Print GetInfoCriteria
'
[Loan#] = DLookup("[ACCOUNT_NUMBER]", "tbl_GetInfo", GetInfoCriteria)
[Inv] = DLookup("[INVESTOR_CODE]", "tbl_GetInfo", GetInfoCriteria)
[Name] = DLookup("[BORROWER_PRIMARY_NAME]", "tbl_GetInfo", GetInfoCriteria)
[Status] = DLookup("[LOAN_OTS_OVERALL_STATUS]", "tbl_GetInfo", GetInfoCriteria)
Sorry I hope that helps
DLookupfunction return what you expect? Does the [Loan#] control contain what you expect? - Beth