S
seeker
I have a listbox on a form. When the vbkeyreturn occurs the following code
runs:
Private Sub lbxNameSearch_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
Forms!frmchecks.TRA_TOWHOM = DLookup("[tra:towhom]", "transactions",
"[tra:towhom] = '" & Me.lbxNameSearch.ItemData(Me.CurrentRecord) & "'")
Forms!frmchecks.TRA_TOWHOM2 = DLookup("[tra:towhom2]", "transactions",
"[tra:towhom] = '" & Me.lbxNameSearch.ItemData(varItem) & "'")
Forms!frmchecks.TRA_TOWHOM3 = DLookup("[tra:towhom3]", "transactions",
"[tra:towhom] = '" & Me.lbxNameSearch.ItemData(varItem) & "'")
DoCmd.Close acForm, "frmnamesearch"
End If
I am using dlookup to capture the data piece but instead of capturing the
selected record it transfers the first record in the list to the other form.
How do I get the selected records data to transfer? Thanks
runs:
Private Sub lbxNameSearch_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
Forms!frmchecks.TRA_TOWHOM = DLookup("[tra:towhom]", "transactions",
"[tra:towhom] = '" & Me.lbxNameSearch.ItemData(Me.CurrentRecord) & "'")
Forms!frmchecks.TRA_TOWHOM2 = DLookup("[tra:towhom2]", "transactions",
"[tra:towhom] = '" & Me.lbxNameSearch.ItemData(varItem) & "'")
Forms!frmchecks.TRA_TOWHOM3 = DLookup("[tra:towhom3]", "transactions",
"[tra:towhom] = '" & Me.lbxNameSearch.ItemData(varItem) & "'")
DoCmd.Close acForm, "frmnamesearch"
End If
I am using dlookup to capture the data piece but instead of capturing the
selected record it transfers the first record in the list to the other form.
How do I get the selected records data to transfer? Thanks