Question, I am trying to test within VBA using DLookup if a records exists in table called tblAllocations prior to another action taking place. For some reason I cannot get the desired results. I want to lookup if intTransactionID exist in tblAllocations, if so it should display and MsgBox otherwise it should continue with the code. For example, from my form called frmTransactions if idsTransactionID (control name) has a matching record in tblAllocations for intTransactionID (field name) then it should display MsgBox and exit the sub; otherwise continue with code.
Dim LAllocationID As Integer
If LAllocationID = DLookup("intTransactionID", "tblAllocations", "intTransactionID = " & Forms!frmTransactions!idsTransactionID) Then
MsgBox whatever will go here.