Ok sorry I wasn't so clear before, I wrote the original post while in the middle of a CSA Class (Client Support Admin) for work.
The following code is placed on the Listbox(SENTLIST) doubleclick event.
Code:
IM.Value = DLookup("[IM]", "IMMtbl", "[IMID] = " & SENTLIST.Value)
I have a listbox with 2 2-line values...of course this could be 5 2-line values depending on what the row source query pulls.
Listbox ------------------------------
| Name | Message |
| Name | Message |
|_________|____________|
This listbox is generated from a query that pulls 5 values from a table.
1)RID
text users netID jeffrey.loehr
2)IM
text(memo) message Hey what's up!
3)SD
yes/no whether or not 1 user wants to delete this
4)SID
text users netID rod.lyons
5)IMID
autonumber primary key 24
Below the listbox I have a memo(textbox) called IM
All I want is when the user double clicks the listbox it calls dlookup on the table that the listbox is generated from and gets the IM.value from the recordset that the user chose from the SENTLIST(listbox). I'm used to a listbox.value being the boundcolumn from the properties and in this case I've chosen 5. I'm only showing 2 columns (column count) on the listbox, but this should matter... or at least hasn't in the past on other projects (all have 'show' property checked in the query.
And no... it's not a multi-select listbox.
The error I'm getting is
Run-time error '3075':
Syntax error (missing operator) in query expression '[IMID] = '.
I know if the WHERE part of a dlookup function is a string you have to use "[IMID = '" & SENTLIST.value & "'")
and if it's a date you would use "[IMID] = #" & SENTLIST.value & "#")
but this is an autonumber which to my knowledge you don't use anything.
Any help would be appreciated.